diff options
author | Neil <nyamatongwe@gmail.com> | 2025-04-18 09:20:38 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-04-18 09:20:38 +1000 |
commit | c1de3774867127539b9b93efd4a0832a3f3a9fcf (patch) | |
tree | 8109f426718be98882a78c9369fbd9c4ca64224f /src/Editor.cxx | |
parent | d36d669ddfd447fbbe28faef18457177bf102881 (diff) | |
download | scintilla-mirror-c1de3774867127539b9b93efd4a0832a3f3a9fcf.tar.gz |
Control restoring vertical scroll position for undo with
SC_UNDO_SELECTION_HISTORY_SCROLL flag to SCI_SETUNDOSELECTIONHISTORY.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index ead69617d..334600461 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2409,12 +2409,14 @@ void Editor::SelectAll() { void Editor::RestoreSelection(Sci::Position newPos, UndoRedo history) { EnsureModelState(); - if ((undoSelectionHistoryOption == UndoSelectionHistoryOption::Enabled) && modelState) { + if (FlagSet(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 SelectionWithScroll selAndLine = modelState->SelectionFromStack(index, history); if (!selAndLine.selection.empty()) { - ScrollTo(selAndLine.topLine); + if (FlagSet(undoSelectionHistoryOption, UndoSelectionHistoryOption::Scroll)) { + ScrollTo(selAndLine.topLine); + } sel = Selection(selAndLine.selection); if (sel.IsRectangular()) { const size_t mainForRectangular = sel.Main(); @@ -2799,7 +2801,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); } } else { - if ((undoSelectionHistoryOption == UndoSelectionHistoryOption::Enabled) && + if (FlagSet(undoSelectionHistoryOption, UndoSelectionHistoryOption::Enabled) && FlagSet(mh.modificationType, ModificationFlags::User)) { if (FlagSet(mh.modificationType, ModificationFlags::BeforeInsert | ModificationFlags::BeforeDelete)) { RememberSelectionForUndo(pdoc->UndoCurrent()); |