From f39367fc4c7af72caef8e20b1e9b1a038e242b0a Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 16 Feb 2024 09:52:43 +1100 Subject: Implement detach point access with SCI_SETUNDODETACH and SCI_GETUNDODETACH. Write more documentation for undo history. --- src/UndoHistory.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/UndoHistory.cxx') 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); } -- cgit v1.2.3