]> git.lyx.org Git - features.git/commitdiff
Alfredo getchar() fix
authorJohn Levon <levon@movementarian.org>
Wed, 9 Apr 2003 22:28:51 +0000 (22:28 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 9 Apr 2003 22:28:51 +0000 (22:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6751 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 1e86b887a5876f232de727add8782e2f1c935d09..5b00bc878726d794b43d614bc31413e0c7f609cb 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-09  Alfredo Braunstein  <abraunst@libero.it>
+
+       * text2.C (cursorRight): a getChar assert fixed 
+
 2003-04-09  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * text2.C (getFont): change to take a ParagraphList::iterator
index 80335014393a33c5b1765fb6642fed8bbc1c6537..2ba74b766086cc9dd895bc4750cfbf094c4a646d 100644 (file)
@@ -2055,10 +2055,13 @@ void LyXText::cursorLeft(bool internal)
 
 void LyXText::cursorRight(bool internal)
 {
-       if (!internal && cursor.boundary() &&
-           !cursor.par()->isNewline(cursor.pos()))
+       bool const at_end = (cursor.pos() == cursor.par()->size());
+       bool const at_newline = !at_end &&
+               cursor.par()->isNewline(cursor.pos());
+
+       if (!internal && cursor.boundary() && !at_newline)
                setCursor(cursor.par(), cursor.pos(), true, false);
-       else if (cursor.pos() < cursor.par()->size()) {
+       else if (!at_end) {
                setCursor(cursor.par(), cursor.pos() + 1, true, false);
                if (!internal &&
                    isBoundary(bv()->buffer(), &*cursor.par(), cursor.pos()))