diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2023-04-18 11:58:19 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-08-22 14:40:19 +0300 |
commit | b1be61a1f449360187a6d9ff0b49f837177ffe9a (patch) | |
tree | 29b41b9eac0d6c4d5a862614e941d6d3cca8a444 | |
parent | e04f4e9a885a832ff13906cb1fd1e9b8abfd1922 (diff) | |
download | scintilla-mirror-b1be61a1f449360187a6d9ff0b49f837177ffe9a.tar.gz |
disable automatic scrolling and choosing the X that caret sticks to
* SciTECO needs to avoid automatic scrolling as an optimization.
While this works partially by avoiding certain messages like SCI_GOTOPOS (in favor of SCI_SETEMPTYSELECTION),
there aren't alternatives for all messages that scroll.
For instance SCI_UNDO will always call EnsureCaretVisible().
Also, even if we could avoid all scrolling messages, there is no guarantee that will not suddenly
and unexpectedly break in the future.
* Instead, every scrolling is now disabled except for an explicit SCI_SCROLLCARET.
SciTECO can therefore use the more intuitive messages like SCI_GOTOPOS.
* SetLastXChosen() (choosing the X that caret sticks to) has been found to be a major slow down
during UNDO and serves no purpose on SciTECO anyway - we have to implement such an algorithm
at the SciTECO language level.
We therefore simply disable SetLastXChosen().
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index e0b05ab07..d5a06d6ed 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -929,8 +929,10 @@ Point Editor::PointMainCaret() { * as it moves up and down. */ void Editor::SetLastXChosen() { +#if 0 const Point pt = PointMainCaret(); lastXChosen = static_cast<int>(pt.x) + xOffset; +#endif } void Editor::RememberSelectionForUndo(int index) { @@ -1442,11 +1444,13 @@ void Editor::ScrollRange(SelectionRange range) { } void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { +#if 0 SetXYScroll(XYScrollToMakeVisible(SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), (useMargin?XYScrollOptions::useMargin:XYScrollOptions::none)| (vert?XYScrollOptions::vertical:XYScrollOptions::none)| (horiz?XYScrollOptions::horizontal:XYScrollOptions::none), caretPolicies)); +#endif } void Editor::ShowCaretAtCurrentPosition() { @@ -6592,7 +6596,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { break; case Message::ScrollCaret: - EnsureCaretVisible(); + SetXYScroll(XYScrollToMakeVisible(SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), + XYScrollOptions::useMargin | XYScrollOptions::vertical | XYScrollOptions::horizontal, + caretPolicies)); break; case Message::SetReadOnly: |