]> git.lyx.org Git - features.git/commitdiff
* stay in front of insets/segment on RTL/LTR boundary
authorStefan Schimanski <sts@lyx.org>
Mon, 4 Jun 2007 18:35:03 +0000 (18:35 +0000)
committerStefan Schimanski <sts@lyx.org>
Mon, 4 Jun 2007 18:35:03 +0000 (18:35 +0000)
  (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

index 2773df6847cf537094ceaee245deb2c0a36e69f2..bbb2c4233bdc3600b24c45fd41295a51e36f37a2 100644 (file)
@@ -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);
        }