aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/UndoHistory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/UndoHistory.h')
-rw-r--r--src/UndoHistory.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/UndoHistory.h b/src/UndoHistory.h
index 349ca2665..8975b4362 100644
--- a/src/UndoHistory.h
+++ b/src/UndoHistory.h
@@ -10,16 +10,21 @@
namespace Scintilla::Internal {
-class UndoAction {
+class UndoActionType {
public:
- ActionType at = ActionType::insert;
- bool mayCoalesce = false;
- Sci::Position position = 0;
- Sci::Position lenData = 0;
-
- UndoAction() noexcept;
- void Create(ActionType at_, Sci::Position position_=0, Sci::Position lenData_=0, bool mayCoalesce_=true) noexcept;
- void Clear() noexcept;
+ ActionType at : 4;
+ bool mayCoalesce : 1;
+ UndoActionType() noexcept;
+};
+
+struct UndoActions {
+ std::vector<UndoActionType> types;
+ std::vector<Sci::Position> positions;
+ std::vector<Sci::Position> lengths;
+
+ void resize(size_t length);
+ [[nodiscard]] size_t size() const noexcept;
+ void Create(size_t index, ActionType at_, Sci::Position position_ = 0, Sci::Position lenData_ = 0, bool mayCoalesce_ = true) noexcept;
};
class ScrapStack {
@@ -38,7 +43,7 @@ public:
*
*/
class UndoHistory {
- std::vector<UndoAction> actions;
+ UndoActions actions;
int maxAction = 0;
int currentAction = 0;
int undoSequenceDepth = 0;