diff options
author | nyamatongwe <nyamatongwe@gmail.com> | 2013-07-03 16:16:24 -0700 |
---|---|---|
committer | nyamatongwe <nyamatongwe@gmail.com> | 2013-07-03 16:16:24 -0700 |
commit | 9ed48352d36acfc5907071bc4ef683007b1a36c6 (patch) | |
tree | 165a18fa28741d60eff1e7a0d49565764a24f018 | |
parent | 8f8bba5e2098f3400ed0d3c4b54f4e3cbcef2ca3 (diff) | |
download | scintilla-mirror-9ed48352d36acfc5907071bc4ef683007b1a36c6.tar.gz |
Restore return of data from InsertString/DeleteChars.
-rw-r--r-- | src/CellBuffer.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 694260821..98f9abe1c 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -391,9 +391,8 @@ int CellBuffer::GapPosition() const { return substance.GapPosition(); } -// The char* returned is to an allocation owned by the undo history +// The char* returned is to the input argument 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 if (!readOnly) { if (collectingUndo) { @@ -404,7 +403,7 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng BasicInsertString(position, s, insertLength); } - return data; + return s; } bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) { @@ -433,16 +432,16 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, cha return changed; } -// The char* returned is to an allocation owned by the undo history +// The char* returned is to data still in the buffer 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); + data = substance.RangePointer(position, deleteLength); uh.AppendAction(removeAction, position, data, deleteLength, startSequence); } |