From e99c07091ec1cebc855bcda42426286872d3a667 Mon Sep 17 00:00:00 2001 From: John Ehresman Date: Sat, 2 Mar 2024 16:58:47 +1100 Subject: Feature [feature-requests:#1511] Add mayCoalesce argument to BeginUndoAction. --- qt/ScintillaEdit/ScintillaDocument.cpp | 4 ++-- qt/ScintillaEdit/ScintillaDocument.h | 2 +- src/CellBuffer.cxx | 4 ++-- src/CellBuffer.h | 2 +- src/Document.h | 2 +- src/UndoHistory.cxx | 4 ++-- src/UndoHistory.h | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qt/ScintillaEdit/ScintillaDocument.cpp b/qt/ScintillaEdit/ScintillaDocument.cpp index 977edc45f..b1091cec8 100644 --- a/qt/ScintillaEdit/ScintillaDocument.cpp +++ b/qt/ScintillaEdit/ScintillaDocument.cpp @@ -153,8 +153,8 @@ bool ScintillaDocument::is_collecting_undo() { return (static_cast(pdoc))->IsCollectingUndo(); } -void ScintillaDocument::begin_undo_action() { - (static_cast(pdoc))->BeginUndoAction(); +void ScintillaDocument::begin_undo_action(bool coalesceWithPrior) { + (static_cast(pdoc))->BeginUndoAction(coalesceWithPrior); } void ScintillaDocument::end_undo_action() { diff --git a/qt/ScintillaEdit/ScintillaDocument.h b/qt/ScintillaEdit/ScintillaDocument.h index 8108fd2fa..fa129d53b 100644 --- a/qt/ScintillaEdit/ScintillaDocument.h +++ b/qt/ScintillaEdit/ScintillaDocument.h @@ -50,7 +50,7 @@ public: void delete_undo_history(); bool set_undo_collection(bool collect_undo); bool is_collecting_undo(); - void begin_undo_action(); + void begin_undo_action(bool coalesceWithPrior = false); void end_undo_action(); void set_save_point(); bool is_save_point(); diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 1ffc749bf..bf0ca6ba5 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -1062,8 +1062,8 @@ bool CellBuffer::IsCollectingUndo() const noexcept { return collectingUndo; } -void CellBuffer::BeginUndoAction() noexcept { - uh->BeginUndoAction(); +void CellBuffer::BeginUndoAction(bool mayCoalesce) noexcept { + uh->BeginUndoAction(mayCoalesce); } void CellBuffer::EndUndoAction() noexcept { diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 1c598480f..3a72601a6 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -164,7 +164,7 @@ public: bool SetUndoCollection(bool collectUndo) noexcept; bool IsCollectingUndo() const noexcept; - void BeginUndoAction() noexcept; + void BeginUndoAction(bool mayCoalesce=false) noexcept; void EndUndoAction() noexcept; void AddUndoAction(Sci::Position token, bool mayCoalesce); void DeleteUndoHistory() noexcept; diff --git a/src/Document.h b/src/Document.h index 912c719b5..102af4d2e 100644 --- a/src/Document.h +++ b/src/Document.h @@ -395,7 +395,7 @@ public: return cb.SetUndoCollection(collectUndo); } bool IsCollectingUndo() const noexcept { return cb.IsCollectingUndo(); } - void BeginUndoAction() noexcept { cb.BeginUndoAction(); } + void BeginUndoAction(bool coalesceWithPrior=false) noexcept { cb.BeginUndoAction(coalesceWithPrior); } void EndUndoAction() noexcept { cb.EndUndoAction(); } void AddUndoAction(Sci::Position token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } void SetSavePoint(); diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx index 0c8644f16..c94d0690c 100644 --- a/src/UndoHistory.cxx +++ b/src/UndoHistory.cxx @@ -322,10 +322,10 @@ const char *UndoHistory::AppendAction(ActionType at, Sci::Position position, con return dataNew; } -void UndoHistory::BeginUndoAction() noexcept { +void UndoHistory::BeginUndoAction(bool mayCoalesce) noexcept { if (undoSequenceDepth == 0) { if (currentAction > 0) { - actions.types[PreviousAction()].mayCoalesce = false; + actions.types[PreviousAction()].mayCoalesce = mayCoalesce; } } undoSequenceDepth++; diff --git a/src/UndoHistory.h b/src/UndoHistory.h index 8de636f8d..8d39a908d 100644 --- a/src/UndoHistory.h +++ b/src/UndoHistory.h @@ -97,7 +97,7 @@ public: const char *AppendAction(ActionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true); - void BeginUndoAction() noexcept; + void BeginUndoAction(bool mayCoalesce=false) noexcept; void EndUndoAction() noexcept; void DropUndoSequence() noexcept; void DeleteUndoHistory() noexcept; -- cgit v1.2.3