From a6cef65c0713b7bb55315a0d4f1cfd83f90bf3c1 Mon Sep 17 00:00:00 2001 From: McLoo Date: Fri, 21 Feb 2020 02:15:24 +0100 Subject: Backport: Feature [feature-requests:497] Automatically scroll while dragging text. Added automatic scrolling when text dragged near edge of window. Backport of changeset 7989:e98f6731bd39. --- doc/ScintillaHistory.html | 5 +++++ src/Editor.cxx | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index bdef04b8f..36b002bf5 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -544,6 +544,7 @@ Andreas Falkenhahn Mark Reay David Shuman + McLoo

@@ -588,6 +589,10 @@ CF_UNICODETEXT.

  • + Automatically scroll while dragging text. + Feature #497. +
  • +
  • On Win32, the numeric keypad with Alt pressed can be used to enter characters by number. This can produce unexpected results in non-numlock mode when function keys are assigned. Potentially problematic keys like Alt+KeypadUp are now ignored. diff --git a/src/Editor.cxx b/src/Editor.cxx index 5da9f2b75..1256082ed 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4257,6 +4257,20 @@ void Editor::SetDragPosition(SelectionPosition newPos) { posDrop = newPos; } if (!(posDrag == newPos)) { + const int oldCaretYPolicy = caretYPolicy; + const int oldCaretYSlop = caretYSlop; + const int oldCaretXPolicy = caretXPolicy; + const int oldCaretXSlop = caretXSlop; + caretYPolicy = CARET_SLOP | CARET_STRICT | CARET_EVEN; + caretYSlop = 2; + caretXPolicy = CARET_SLOP | CARET_STRICT | CARET_EVEN; + caretXSlop = 50; + MovedCaret(newPos, posDrag, true); + caretYPolicy = oldCaretYPolicy; + caretYSlop = oldCaretYSlop; + caretXPolicy = oldCaretXPolicy; + caretXSlop = oldCaretXSlop; + caret.on = true; FineTickerCancel(tickCaret); if ((caret.active) && (caret.period > 0) && (newPos.Position() < 0)) -- cgit v1.2.3