aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-04-03 12:02:22 +0000
committernyamatongwe <unknown>2000-04-03 12:02:22 +0000
commita6287025efa4865b76b2700abceb9ede9a544307 (patch)
tree07bf07fe658f12e2ae734b61af1ca53ec8598a8f
parent0e6e05226f69f7bdd5fe4415a43be5be882b414c (diff)
downloadscintilla-mirror-a6287025efa4865b76b2700abceb9ede9a544307.tar.gz
Fixed problems with undo history not coalescing undo nodes correctly.
-rw-r--r--src/CellBuffer.cxx12
-rw-r--r--src/CellBuffer.h3
2 files changed, 11 insertions, 4 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 1b1320667..4d032f94f 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -315,12 +315,13 @@ Action::~Action() {
Destroy();
}
-void Action::Create(actionType at_, int position_, char *data_, int lenData_) {
+void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) {
delete []data;
position = position_;
at = at_;
data = data_;
lenData = lenData_;
+ mayCoalesce = mayCoalesce_;
}
void Action::Destroy() {
@@ -335,12 +336,14 @@ void Action::Grab(Action *source) {
at = source->at;
data = source->data;
lenData = source->lenData;
-
+ mayCoalesce = source->mayCoalesce;
+
// Ownership of source data transferred to this
source->position = 0;
source->at = startAction;
source->data = 0;
source->lenData = 0;
+ source->mayCoalesce = true;
}
// The undo history stores a sequence of user operations that represent the user's view of the
@@ -425,7 +428,9 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
//Platform::DebugPrintf("action coalesced\n");
}
} else {
- currentAction++;
+ // Actions not at top level are always coalesced unless this is after return to top level
+ if (!actions[currentAction].mayCoalesce)
+ currentAction++;
}
} else {
currentAction++;
@@ -457,6 +462,7 @@ void UndoHistory::EndUndoAction() {
actions[currentAction].Create(startAction);
maxAction = currentAction;
}
+ actions[currentAction].mayCoalesce = false;
}
}
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 6e052077e..1d7f57b05 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -79,10 +79,11 @@ public:
int position;
char *data;
int lenData;
+ bool mayCoalesce;
Action();
~Action();
- void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0);
+ void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true);
void Destroy();
void Grab(Action *source);
};