aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-02-01 16:37:24 +1100
committerNeil <nyamatongwe@gmail.com>2024-02-01 16:37:24 +1100
commit2d69e7321020afde6fb8c45943c5d59781461e6b (patch)
tree4f19e0c15f4d139a9df6f68f429d32a5e876b8ff /src
parentfa3f060e142243c7848284f16561d4af9f9ee935 (diff)
downloadscintilla-mirror-2d69e7321020afde6fb8c45943c5d59781461e6b.tar.gz
Prefer member initializers. Simplify logic.
Diffstat (limited to 'src')
-rw-r--r--src/UndoHistory.cxx10
-rw-r--r--src/UndoHistory.h10
2 files changed, 6 insertions, 14 deletions
diff --git a/src/UndoHistory.cxx b/src/UndoHistory.cxx
index bc1a4d36a..88e931ea9 100644
--- a/src/UndoHistory.cxx
+++ b/src/UndoHistory.cxx
@@ -101,15 +101,8 @@ const char *ScrapStack::TextAt(size_t position) const noexcept {
// Sequences that look like typing or deletion are coalesced into a single user operation.
UndoHistory::UndoHistory() {
-
actions.resize(3);
- maxAction = 0;
- currentAction = 0;
- undoSequenceDepth = 0;
- savePoint = 0;
- tentativePoint = -1;
scraps = std::make_unique<ScrapStack>();
-
actions[currentAction].Create(ActionType::start);
}
@@ -287,8 +280,7 @@ int UndoHistory::TentativeSteps() noexcept {
currentAction--;
if (tentativePoint >= 0)
return currentAction - tentativePoint;
- else
- return -1;
+ return -1;
}
bool UndoHistory::CanUndo() const noexcept {
diff --git a/src/UndoHistory.h b/src/UndoHistory.h
index 98df93465..349ca2665 100644
--- a/src/UndoHistory.h
+++ b/src/UndoHistory.h
@@ -39,11 +39,11 @@ public:
*/
class UndoHistory {
std::vector<UndoAction> actions;
- int maxAction;
- int currentAction;
- int undoSequenceDepth;
- int savePoint;
- int tentativePoint;
+ int maxAction = 0;
+ int currentAction = 0;
+ int undoSequenceDepth = 0;
+ int savePoint = 0;
+ int tentativePoint = -1;
std::optional<int> detach;
std::unique_ptr<ScrapStack> scraps;