]> git.lyx.org Git - features.git/commitdiff
fix a bug in visual cursor movement
authorDov Feldstern <dov@lyx.org>
Sat, 1 Nov 2008 17:00:58 +0000 (17:00 +0000)
committerDov Feldstern <dov@lyx.org>
Sat, 1 Nov 2008 17:00:58 +0000 (17:00 +0000)
The setting of boundary need to take the paragraph's direction (LTR/RTL) into
account.

This bug was discovered by Vincent, while trying to solve bug #5061.

While this fixes the original manifestation of bug #5061, it doesn't really
solve the underlying issue, which is that on a boundary, after typing
Ctrl-Enter, the cursor is painted on the same line as the newline symbol
rather than on the new line. See bugzilla for further discussion of this.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27225 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index 38ce314f68ae5dba3f2155d19bb41c7d6c63f837..7232e88e0f14f0a2837a90d8d9ad13d760c8d5bd 100644 (file)
@@ -507,10 +507,11 @@ bool Cursor::posVisRight(bool skip_inset)
                        new_cur.pos() = right_pos + 1;
                        // set the boundary to true in two situations:
                        if (
-                       // 1. if new_pos is now lastpos (which means that we're moving 
-                       // right to the end of an LTR chunk which is at the end of an
-                       // RTL paragraph);
-                               new_cur.pos() == lastpos()
+                       // 1. if new_pos is now lastpos, and we're in an RTL paragraph
+                       // (this means that we're moving right to the end of an LTR chunk
+                       // which is at the end of an RTL paragraph);
+                               (new_cur.pos() == lastpos()
+                                && paragraph().isRTL(buffer().params()))
                        // 2. if the position *after* right_pos is RTL (we want to be 
                        // *after* right_pos, not before right_pos + 1!)
                                || paragraph().getFontSettings(bv().buffer().params(),
@@ -598,10 +599,11 @@ bool Cursor::posVisLeft(bool skip_inset)
                        new_cur.pos() = left_pos + 1;
                        // set the boundary to true in two situations:
                        if (
-                       // 1. if new_pos is now lastpos (which means that we're moving left
-                       // to the end of an RTL chunk which is at the end of an LTR 
-                       // paragraph);
-                               new_cur.pos() == lastpos()
+                       // 1. if new_pos is now lastpos and we're in an LTR paragraph
+                       // (this means that we're moving left to the end of an RTL chunk
+                       // which is at the end of an LTR paragraph);
+                               (new_cur.pos() == lastpos()
+                                && !paragraph().isRTL(buffer().params()))
                        // 2. if the position *after* left_pos is not RTL (we want to be 
                        // *after* left_pos, not before left_pos + 1!)
                                || !paragraph().getFontSettings(bv().buffer().params(),