aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-04-19 09:50:09 +0000
committernyamatongwe <unknown>2010-04-19 09:50:09 +0000
commitad8e3b7b20b3b7ad4c3b6cc573bd0642d601c4ef (patch)
treeb5502d674ddbcbb9f172640467b2ce7194b7c1f2 /src/CellBuffer.cxx
parentce8b7a0aea667543c8149b0c809c238391355f69 (diff)
downloadscintilla-mirror-ad8e3b7b20b3b7ad4c3b6cc573bd0642d601c4ef.tar.gz
Potential fix to bug #974009 and #2986727 Markers don't move when return is
hit at start of line.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r--src/CellBuffer.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index de499ad68..d349040f0 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -44,9 +44,11 @@ void LineVector::InsertText(int line, int delta) {
starts.InsertText(line, delta);
}
-void LineVector::InsertLine(int line, int position) {
+void LineVector::InsertLine(int line, int position, bool lineStart) {
starts.InsertPartition(line, position);
if (perLine) {
+ if ((line > 0) && lineStart)
+ line--;
perLine->InsertLine(line);
}
}
@@ -473,8 +475,8 @@ bool CellBuffer::IsSavePoint() {
// Without undo
-void CellBuffer::InsertLine(int line, int position) {
- lv.InsertLine(line, position);
+void CellBuffer::InsertLine(int line, int position, bool lineStart) {
+ lv.InsertLine(line, position, lineStart);
}
void CellBuffer::RemoveLine(int line) {
@@ -490,30 +492,32 @@ void CellBuffer::BasicInsertString(int position, const char *s, int insertLength
style.InsertValue(position, insertLength, 0);
int lineInsert = lv.LineFromPosition(position) + 1;
+ bool atLineStart = lv.LineStart(lineInsert-1) == position;
// Point all the lines after the insertion point further along in the buffer
lv.InsertText(lineInsert-1, insertLength);
char chPrev = substance.ValueAt(position - 1);
char chAfter = substance.ValueAt(position + insertLength);
if (chPrev == '\r' && chAfter == '\n') {
// Splitting up a crlf pair at position
- InsertLine(lineInsert, position);
+ InsertLine(lineInsert, position, false);
lineInsert++;
}
char ch = ' ';
for (int i = 0; i < insertLength; i++) {
ch = s[i];
if (ch == '\r') {
- InsertLine(lineInsert, (position + i) + 1);
+ InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++;
} else if (ch == '\n') {
if (chPrev == '\r') {
// Patch up what was end of line
lv.SetLineStart(lineInsert - 1, (position + i) + 1);
} else {
- InsertLine(lineInsert, (position + i) + 1);
+ InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++;
}
}
+ atLineStart = false;
chPrev = ch;
}
// Joining two lines where last insertion is cr and following substance starts with lf