diff options
author | Neil <nyamatongwe@gmail.com> | 2025-01-25 08:40:06 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-01-25 08:40:06 +1100 |
commit | f2bc1988dba5ca23692020017aa6f9ee2b4d71cf (patch) | |
tree | d4a01f6ce4ad7fd5afa7a2b65b6a68c1cf932f96 /src/Editor.cxx | |
parent | 3de9d37c7b8f4501558d309ada718dc52533e94c (diff) | |
download | scintilla-mirror-f2bc1988dba5ca23692020017aa6f9ee2b4d71cf.tar.gz |
Bug [#1224]. Use enum for undo selection history and make API names more
consistent as 'undo selection' instead of 'selection undo' as more closely
associated with undo than selection.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 8a7b15719..d63f43f3f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2399,7 +2399,7 @@ void Editor::SelectAll() { } void Editor::RestoreSelection(Sci::Position newPos, UndoRedo history) { - if (rememberingSelectionForUndo && modelState) { + 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 SelectionSimple *pss = modelState->SelectionFromStack(index, history); @@ -2789,7 +2789,8 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); } } else { - if (rememberingSelectionForUndo && FlagSet(mh.modificationType, ModificationFlags::User)) { + if ((undoSelectionHistoryOption == UndoSelectionHistoryOption::Enabled) && + FlagSet(mh.modificationType, ModificationFlags::User)) { if (FlagSet(mh.modificationType, ModificationFlags::BeforeInsert | ModificationFlags::BeforeDelete)) { RememberSelectionForUndo(pdoc->UndoCurrent()); } @@ -8687,12 +8688,12 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::GetChangeHistory: return static_cast<sptr_t>(changeHistoryOption); - case Message::SetSelectionUndoHistory: - rememberingSelectionForUndo = wParam; + case Message::SetUndoSelectionHistory: + undoSelectionHistoryOption = static_cast<UndoSelectionHistoryOption>(wParam); break; - case Message::GetSelectionUndoHistory: - return rememberingSelectionForUndo; + case Message::GetUndoSelectionHistory: + return static_cast<sptr_t>(undoSelectionHistoryOption); case Message::SetExtraAscent: vs.extraAscent = static_cast<int>(wParam); |