diff options
author | Neil <nyamatongwe@gmail.com> | 2025-02-07 09:28:54 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-02-07 09:28:54 +1100 |
commit | 50d1e46ea7d6de76fc8d676888d9e14475fda04f (patch) | |
tree | 7597a1cc9a0c364e2c32479479c93c950dd41ae7 /src/Editor.cxx | |
parent | 2d14f22ef515b936e119940e7738ad1e08fcd2c7 (diff) | |
download | scintilla-mirror-50d1e46ea7d6de76fc8d676888d9e14475fda04f.tar.gz |
Add vertical scroll position into undo selection history unconditionally.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 77d2eb175..283edff8f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -951,7 +951,7 @@ void Editor::RememberSelectionOntoStack(int index) { if (!pdoc->AfterUndoSequenceStart()) { // Don't remember selections inside a grouped sequence as can only // unto or redo to the start and end of the group. - modelState->RememberSelectionOntoStack(index); + modelState->RememberSelectionOntoStack(index, topLine); } } } @@ -960,7 +960,7 @@ void Editor::RememberCurrentSelectionForRedoOntoStack() { if (needRedoRemembered && (pdoc->UndoSequenceDepth() == 0)) { EnsureModelState(); if (modelState) { - modelState->RememberSelectionForRedoOntoStack(pdoc->UndoCurrent(), sel); + modelState->RememberSelectionForRedoOntoStack(pdoc->UndoCurrent(), sel, topLine); needRedoRemembered = false; } } @@ -2412,9 +2412,10 @@ void Editor::RestoreSelection(Sci::Position newPos, UndoRedo history) { if ((undoSelectionHistoryOption == UndoSelectionHistoryOption::Enabled) && modelState) { // Undo wants the element after the current as it just undid it const int index = pdoc->UndoCurrent() + (history == UndoRedo::undo ? 1 : 0); - const std::string_view ss = modelState->SelectionFromStack(index, history); - if (!ss.empty()) { - sel = Selection(ss); + const SelectionWithScroll selAndLine = modelState->SelectionFromStack(index, history); + if (!selAndLine.selection.empty()) { + ScrollTo(selAndLine.topLine); + sel = Selection(selAndLine.selection); if (sel.IsRectangular()) { const size_t mainForRectangular = sel.Main(); // Reconstitute ranges from rectangular range |