aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/EditModel.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-02-07 09:28:54 +1100
committerNeil <nyamatongwe@gmail.com>2025-02-07 09:28:54 +1100
commit50d1e46ea7d6de76fc8d676888d9e14475fda04f (patch)
tree7597a1cc9a0c364e2c32479479c93c950dd41ae7 /src/EditModel.h
parent2d14f22ef515b936e119940e7738ad1e08fcd2c7 (diff)
downloadscintilla-mirror-50d1e46ea7d6de76fc8d676888d9e14475fda04f.tar.gz
Add vertical scroll position into undo selection history unconditionally.
Diffstat (limited to 'src/EditModel.h')
-rw-r--r--src/EditModel.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/EditModel.h b/src/EditModel.h
index 1c4823b2e..dcaf99613 100644
--- a/src/EditModel.h
+++ b/src/EditModel.h
@@ -24,7 +24,13 @@ public:
enum class UndoRedo { undo, redo };
// Selection stack is sparse so use a map
-using SelectionStack = std::map<int, std::string>;
+
+struct SelectionWithScroll {
+ std::string selection;
+ Sci::Line topLine = 0;
+};
+
+using SelectionStack = std::map<int, SelectionWithScroll>;
struct SelectionHistory {
int indexCurrent = 0;
@@ -37,9 +43,9 @@ struct ModelState : ViewState {
SelectionHistory historyForRedo;
void RememberSelectionForUndo(int index, const Selection &sel);
void ForgetSelectionForUndo() noexcept;
- void RememberSelectionOntoStack(int index);
- void RememberSelectionForRedoOntoStack(int index, const Selection &sel);
- std::string_view SelectionFromStack(int index, UndoRedo history) const;
+ void RememberSelectionOntoStack(int index, Sci::Line topLine);
+ void RememberSelectionForRedoOntoStack(int index, const Selection &sel, Sci::Line topLine);
+ SelectionWithScroll SelectionFromStack(int index, UndoRedo history) const;
virtual void TruncateUndo(int index) final;
};