Abdelrazak Younes schrieb:
[EMAIL PROTECTED] wrote:
Author: broider
Date: Sun May 13 21:53:06 2007
New Revision: 18293

URL: http://www.lyx.org/trac/changeset/18293
Log:
fix cursor movement (up/down) problem at the end of lines in insets and table cells.

Some in-source-code comments are in order Bernhard. Especially since you removed mine that were not enough already.


You're right.

But there is another issue that i got aware today: The case of rtl text. The attached patch should handle this correctly, but please could somebody have a look at it?

Bernhard
Index: src/Text2.cpp
===================================================================
--- src/Text2.cpp       (revision 18320)
+++ src/Text2.cpp       (working copy)
@@ -993,8 +993,17 @@
 
        int x = cur.targetX();
        cur.setTargetX();
-       if (cur.pos() != pm.rows()[row].endpos() || x < cur.targetX())
+       // We want to keep the x-target on subsequent up movements
+       // that cross beyond the end of short lines. Thus a special
+       // handling when the cursor is at the end of line: Use the new 
+       // x-target only if the old one was before the end of line.
+       bool const rtl = isRTL(*cur.bv().buffer(), pars_[cur.pit()]);
+       if (cur.pos() != pm.rows()[row].endpos() 
+               || (!rtl && x < cur.targetX())
+               || (rtl && x > cur.targetX())) {
+
                x = cur.targetX();
+       }
 
        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, 
cur.boundary()).y_;
@@ -1052,8 +1061,17 @@
 
        int x = cur.targetX();
        cur.setTargetX();
-       if (cur.pos() != pm.rows()[row].endpos() || x < cur.targetX())
+       // We want to keep the x-target on subsequent down movements
+       // that cross beyond the end of short lines. Thus a special
+       // handling when the cursor is at the end of line: Use the new 
+       // x-target only if the old one was before the end of line.
+       bool const rtl = isRTL(*cur.bv().buffer(), pars_[cur.pit()]);
+       if (cur.pos() != pm.rows()[row].endpos() 
+               || (!rtl && x < cur.targetX())
+               || (rtl && x > cur.targetX())) {
+
                x = cur.targetX();
+       }
 
        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, 
cur.boundary()).y_;

Reply via email to