aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-02-01 09:36:08 +1100
committerNeil <nyamatongwe@gmail.com>2024-02-01 09:36:08 +1100
commit252cb0fe25a8cbbce19944033e311203e0fb07dc (patch)
tree49607a3c6cd32981b5ea53598623e706097251ff /src/CellBuffer.h
parentc6b542f84e65083552e52768db7bb4c11dcd7a64 (diff)
downloadscintilla-mirror-252cb0fe25a8cbbce19944033e311203e0fb07dc.tar.gz
Add UndoAction class as internal type for undo actions and make Action a struct
that is used for reporting undo steps to Document. This will allow further minimization of undo memory use.
Diffstat (limited to 'src/CellBuffer.h')
-rw-r--r--src/CellBuffer.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index d71287d1b..ecd646570 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -31,19 +31,14 @@ class ILineVector;
enum class ActionType : unsigned char { insert, remove, start, container };
/**
- * Actions are used to store all the information required to perform one undo/redo step.
+ * Actions are used to return the information required to report one undo/redo step.
*/
-class Action {
-public:
+struct Action {
ActionType at = ActionType::insert;
bool mayCoalesce = false;
Sci::Position position = 0;
- std::unique_ptr<char[]> data;
+ const char *data = nullptr;
Sci::Position lenData = 0;
-
- Action() noexcept;
- void Create(ActionType at_, Sci::Position position_=0, const char *data_=nullptr, Sci::Position lenData_=0, bool mayCoalesce_=true);
- void Clear() noexcept;
};
struct SplitView {
@@ -178,11 +173,11 @@ public:
/// called that many times. Similarly for redo.
bool CanUndo() const noexcept;
int StartUndo() noexcept;
- const Action &GetUndoStep() const noexcept;
+ Action GetUndoStep() const noexcept;
void PerformUndoStep();
bool CanRedo() const noexcept;
int StartRedo() noexcept;
- const Action &GetRedoStep() const noexcept;
+ Action GetRedoStep() const noexcept;
void PerformRedoStep();
void ChangeHistorySet(bool set);