diff options
Diffstat (limited to 'scintilla/src/CellBuffer.cxx')
-rw-r--r-- | scintilla/src/CellBuffer.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index 3c955dc..7d322a9 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -168,7 +168,7 @@ void UndoHistory::EnsureUndoRoom() { }
}
-void UndoHistory::AppendAction(actionType at, int position, const char *data, int lengthData,
+const char *UndoHistory::AppendAction(actionType at, int position, const char *data, int lengthData,
bool &startSequence, bool mayCoalesce) {
EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
@@ -232,10 +232,12 @@ void UndoHistory::AppendAction(actionType at, int position, const char *data, in currentAction++;
}
startSequence = oldCurrentAction != currentAction;
+ int actionWithData = currentAction;
actions[currentAction].Create(at, position, data, lengthData, mayCoalesce);
currentAction++;
actions[currentAction].Create(startAction);
maxAction = currentAction;
+ return actions[actionWithData].data;
}
void UndoHistory::BeginUndoAction() {
@@ -393,13 +395,13 @@ int CellBuffer::GapPosition() const { // The char* returned is to an allocation owned by the undo history
const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) {
- char *data = 0;
// InsertString and DeleteChars are the bottleneck though which all changes occur
+ const char *data = s;
if (!readOnly) {
if (collectingUndo) {
// Save into the undo/redo stack, but only the characters - not the formatting
// This takes up about half load time
- uh.AppendAction(insertAction, position, s, insertLength, startSequence);
+ data = uh.AppendAction(insertAction, position, s, insertLength, startSequence);
}
BasicInsertString(position, s, insertLength);
@@ -437,13 +439,13 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, cha const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) {
// InsertString and DeleteChars are the bottleneck though which all changes occur
PLATFORM_ASSERT(deleteLength > 0);
- char *data = 0;
+ const char *data = 0;
if (!readOnly) {
if (collectingUndo) {
// Save into the undo/redo stack, but only the characters - not the formatting
// The gap would be moved to position anyway for the deletion so this doesn't cost extra
- const char *data = substance.RangePointer(position, deleteLength);
- uh.AppendAction(removeAction, position, data, deleteLength, startSequence);
+ data = substance.RangePointer(position, deleteLength);
+ data = uh.AppendAction(removeAction, position, data, deleteLength, startSequence);
}
BasicDeleteChars(position, deleteLength);
|