Stefan Schimanski wrote:

Please take care with those changes. Such a +1 can change and break a lot. In this I am pretty sure that a character is skipped when going over a newline. I added a special case for the RTL boundary for this line.


Okay, I think I understand (how many times have I said that about this whole issue already? ;) ). I applied your patch (had to type it in, though, something about "malformed patch") and it works.

Anyhow, I'm attaching your patch back again, just split some line so they would fit (and this time patch should work ;) ).

Please, can someone else check this so that it can be committed? It fixes http://bugzilla.lyx.org/show_bug.cgi?id=3754.

Thanks!
Dov

P.S. Stefan, just to make sure I really do understand: what I hadn't understood until now is "so how does just setting the boundary, without changing the position, make the cursor move?". I think now I get it: when the cursor drawing is done, it looks at the boundary: if the boundary is set, it draws the cursor at the position of the character *before* the boundary, otherwise it draws it at the position of the current character. So moving forward (pos+1) but setting the boundary to true will not register a movement; and staying at the same position, but changing the boundary back to false, *will* appear to move. Is this correct?
Index: src/Text2.cpp
===================================================================
--- src/Text2.cpp       (revision 18579)
+++ src/Text2.cpp       (working copy)
@@ -1030,8 +1030,11 @@
 
        // not at paragraph end?
        if (cur.pos() != cur.lastpos()) {
-               // if left of boundary -> just jump to right side 
-               if (cur.boundary())
+               // 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);
 
                // in front of editable inset, i.e. jump into it?
@@ -1061,6 +1064,12 @@
                                !cur.paragraph().isSeparator(cur.pos())) {
                        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);

Reply via email to