aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/UndoHistory.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-02-16 09:52:43 +1100
committerNeil <nyamatongwe@gmail.com>2024-02-16 09:52:43 +1100
commitf39367fc4c7af72caef8e20b1e9b1a038e242b0a (patch)
treeb5f2fddf5ad5d2b79e72e93ebefa8cf8e7abe4d4 /src/UndoHistory.cxx
parent1681b7fc9da6d455ab73a96816a47f6ba263017c (diff)
downloadscintilla-mirror-f39367fc4c7af72caef8e20b1e9b1a038e242b0a.tar.gz
Implement detach point access with SCI_SETUNDODETACH and SCI_GETUNDODETACH.
Write more documentation for undo history.
Diffstat (limited to 'src/UndoHistory.cxx')
-rw-r--r--src/UndoHistory.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx
index 62f871a60..810cd9a14 100644
--- a/src/UndoHistory.cxx
+++ b/src/UndoHistory.cxx
@@ -395,6 +395,18 @@ bool UndoHistory::AfterSavePoint() const noexcept {
return (savePoint >= 0) && (savePoint <= currentAction);
}
+void UndoHistory::SetDetachPoint(int action) noexcept {
+ if (action == -1) {
+ detach = {};
+ } else {
+ detach = action;
+ }
+}
+
+int UndoHistory::DetachPoint() const noexcept {
+ return detach.value_or(-1);
+}
+
bool UndoHistory::AfterDetachPoint() const noexcept {
return detach && (*detach < currentAction);
}