From ff69e140ac7634ab8ec4365f97f0adae27692b53 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 22 Mar 2000 12:16:54 +0000 Subject: Split UndoHistory out of CellBuffer. Fixed coalescing of nodes in the undo history. Added LineCut, LineDelete, LineTranspose, UpperCase and LowerCase keyboard commands and added keys for them. Added UUID lexical class to CPP lexer. --- src/Document.cxx | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'src/Document.cxx') diff --git a/src/Document.cxx b/src/Document.cxx index b50b9691a..bfb52d36e 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -94,22 +94,25 @@ int Document::LineStart(int line) { return cb.LineStart(line); } -int Document::LineFromPosition(int pos) { - return cb.LineFromPosition(pos); -} - -int Document::LineEndPosition(int position) { - int line = LineFromPosition(position); +int Document::LineEnd(int line) { if (line == LinesTotal() - 1) { - position = LineStart(line + 1); + return LineStart(line + 1); } else { - position = LineStart(line + 1) - 1; + int position = LineStart(line + 1) - 1; // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; } + return position; } - return position; +} + +int Document::LineFromPosition(int pos) { + return cb.LineFromPosition(pos); +} + +int Document::LineEndPosition(int position) { + return LineEnd(LineFromPosition(position)); } int Document::VCHomePosition(int position) { @@ -335,6 +338,7 @@ int Document::Undo() { enteredCount++; bool startSavePoint = cb.IsSavePoint(); int steps = cb.StartUndo(); + Platform::DebugPrintf("Steps=%d\n", steps); for (int step=0; step