From 379097c72c50f509a82c999bdf6b50634e21fa29 Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 9 Apr 2003 22:28:51 +0000 Subject: [PATCH] Alfredo getchar() fix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6751 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/text2.C | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1e86b887a5..5b00bc8787 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-04-09 Alfredo Braunstein + + * text2.C (cursorRight): a getChar assert fixed + 2003-04-09 Lars Gullik Bjønnes * text2.C (getFont): change to take a ParagraphList::iterator diff --git a/src/text2.C b/src/text2.C index 8033501439..2ba74b7660 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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())) -- 2.39.2