aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/CellBuffer.cxx3
-rw-r--r--src/Editor.cxx10
2 files changed, 11 insertions, 2 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index befec75fc..82bf42ee7 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -458,6 +458,9 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
(position != (actPrevious.position + actPrevious.lenData*2))) {
// Insertions must be immediately after to coalesce
currentAction++;
+ } else if (!actions[currentAction].mayCoalesce) {
+ // Not allowed to coalesce if this set
+ currentAction++;
} else {
//Platform::DebugPrintf("action coalesced\n");
}
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 0fab781d9..dc5c03622 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1549,7 +1549,7 @@ void Editor::AddCharUTF(char *s, unsigned int len) {
void Editor::ClearSelection() {
if (selType == selRectangle) {
- pdoc->BeginUndoAction();
+ pdoc->BeginUndoAction();
int lineStart = pdoc->LineFromPosition(SelectionStart());
int lineEnd = pdoc->LineFromPosition(SelectionEnd());
int startPos = SelectionStart();
@@ -1561,23 +1561,27 @@ void Editor::ClearSelection() {
}
}
SetEmptySelection(startPos);
+ pdoc->EndUndoAction();
selType = selStream;
- pdoc->EndUndoAction();
} else {
int startPos = SelectionStart();
unsigned int chars = SelectionEnd() - startPos;
SetEmptySelection(startPos);
if (0 != chars) {
+ pdoc->EndUndoAction();
pdoc->DeleteChars(startPos, chars);
+ pdoc->BeginUndoAction();
}
}
}
void Editor::ClearAll() {
+ pdoc->BeginUndoAction();
if (0 != pdoc->Length()) {
pdoc->DeleteChars(0, pdoc->Length());
}
cs.Clear();
+ pdoc->EndUndoAction();
anchor = 0;
currentPos = 0;
SetTopLine(0);
@@ -1607,6 +1611,7 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
int xInsert = XFromPosition(currentPos);
int line = pdoc->LineFromPosition(currentPos);
bool prevCr = false;
+ pdoc->BeginUndoAction();
for (int i = 0; i < len; i++) {
if ((ptr[i] == '\r') || (ptr[i] == '\n')) {
if ((ptr[i] == '\r') || (!prevCr))
@@ -1626,6 +1631,7 @@ void Editor::PasteRectangular(int pos, const char *ptr, int len) {
prevCr = false;
}
}
+ pdoc->EndUndoAction();
SetEmptySelection(insertPos);
}