From 04d22e6fcd1366d84a5c79c955a82c1827482b08 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 4 Apr 2002 03:10:20 +0000 Subject: Improved caret movement in read-only mode by handling more cases where text is inserted and be removing handling of cases where text is deleted as these are handled automatically in the modification listener. --- src/Document.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/Document.cxx') diff --git a/src/Document.cxx b/src/Document.cxx index 4272dda63..def80c49c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -535,26 +535,18 @@ void Document::DelChar(int pos) { DeleteChars(pos, LenChar(pos)); } -int Document::DelCharBackMove(int pos, int len) { - if (DeleteChars(pos - len, len)) { - return pos - len; - } else { - return pos; - } -} - -int Document::DelCharBack(int pos) { +void Document::DelCharBack(int pos) { if (pos <= 0) { - return pos; + return; } else if (IsCrLf(pos - 2)) { - return DelCharBackMove(pos, 2); + DeleteChars(pos - 2, 2); } else if (SC_CP_UTF8 == dbcsCodePage) { int startChar = MovePositionOutsideChar(pos - 1, -1, false); - return DelCharBackMove(pos, pos - startChar); + DeleteChars(startChar, pos - startChar); } else if (IsDBCS(pos - 1)) { - return DelCharBackMove(pos, 2); + DeleteChars(pos - 2, 2); } else { - return DelCharBackMove(pos, 1); + DeleteChars(pos - 1, 1); } } -- cgit v1.2.3