From 6d67f77467e5d139e989431c9786d9c15f7fdcad Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Mon, 4 Jun 2007 18:35:03 +0000 Subject: [PATCH] * stay in front of insets/segment on RTL/LTR boundary (fixes bug 3754: Cursor movement at RTL-LTR boundary) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18666 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text2.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Text2.cpp b/src/Text2.cpp index 2773df6847..bbb2c4233b 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -1030,14 +1030,16 @@ bool Text::cursorRight(Cursor & cur) // not at paragraph end? if (cur.pos() != cur.lastpos()) { - // if left of boundary -> just jump to right side - if (cur.boundary()) - return setCursor(cur, cur.pit(), cur.pos(), true, false); - // in front of editable inset, i.e. jump into it? if (checkAndActivateInset(cur, true)) return false; - + + // if left of boundary -> just jump to right side + // but for RTL boundaries don't, because: abc|DDEEFFghi -> abcDDEEF|Fghi + if (cur.boundary() && + !bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos())) + return setCursor(cur, cur.pit(), cur.pos(), true, false); + // next position is left of boundary, // but go to next line for special cases like space, newline, linesep #if 0 @@ -1062,6 +1064,11 @@ bool Text::cursorRight(Cursor & cur) return setCursor(cur, cur.pit(), cur.pos() + 1, true, true); } + // in front of RTL boundary? Stay on this side of the boundary because: + // ab|cDDEEFFghi -> abc|DDEEFFghi + if (bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1)) + return setCursor(cur, cur.pit(), cur.pos() + 1, true, true); + // move right return setCursor(cur, cur.pit(), cur.pos() + 1, true, false); } -- 2.39.2