aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/EditModel.cxx2
-rw-r--r--src/EditModel.h2
-rw-r--r--src/Editor.cxx13
3 files changed, 9 insertions, 8 deletions
diff --git a/src/EditModel.cxx b/src/EditModel.cxx
index 60848e6dc..1f9c2d064 100644
--- a/src/EditModel.cxx
+++ b/src/EditModel.cxx
@@ -181,7 +181,7 @@ int EditModel::GetMark(Sci::Line line) const {
}
void EditModel::EnsureModelState() {
- if (!modelState && rememberingSelectionForUndo) {
+ if (!modelState && (undoSelectionHistoryOption == UndoSelectionHistoryOption::Enabled)) {
if (ViewStateShared vss = pdoc->GetViewState(this)) {
modelState = std::dynamic_pointer_cast<ModelState>(vss);
} else {
diff --git a/src/EditModel.h b/src/EditModel.h
index 716fd5788..f75cece44 100644
--- a/src/EditModel.h
+++ b/src/EditModel.h
@@ -92,7 +92,7 @@ public:
Document *pdoc;
- bool rememberingSelectionForUndo = false;
+ Scintilla::UndoSelectionHistoryOption undoSelectionHistoryOption = UndoSelectionHistoryOption::Disabled;
bool needRedoRemembered = false;
ModelStateShared modelState;
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);