[This should be applied after the patch in http://permalink.gmane.org/gmane.editors.lyx.devel/86074, which fixes bug 3754.]

Okay, you guys (Stefan and Andre') are correct, as always ;) .

We really don't need the boundary almost anywhere. The comment on boundary_ in DocIterator.h is (almost) right: the only place we're using it at the moment is for Bidi. It should still be corrected in terms of (i,i+1)->(i-1,i), and also I think an overview of how it's used in cursor drawing is important for understanding how it's to be used, so that should stay there (if you want, tomorrow night I'll send in a suggestion for patching the comment).

At least cursorLeft and cursorRight are much simpler now... I wonder if this'll speed them up a little, too...

One thing that's still bugging is why Left and Right aren't symmetrical. For some reason we still need the condition for Bidi in right, but not in left. I suspect maybe it has to do with the choice of boundary being between (i-1,i), which is in a sense a symmetry break?

Anyhow, please test this against all the cursor-related fixes from the past few days, but I think this'll work, and it's much simpler (and it gets rid of the debug variables, too...)

Good night!
Dov
Index: lyx-devel/src/Text2.cpp
===================================================================
--- lyx-devel.orig/src/Text2.cpp        2007-05-31 02:14:58.000000000 +0300
+++ lyx-devel/src/Text2.cpp     2007-05-31 02:17:39.000000000 +0300
@@ -988,26 +988,6 @@
 
        // not at paragraph start?
        if (cur.pos() > 0) {
-               // if on right side of boundary (i.e. not at paragraph end, but 
line end)
-               // -> skip it, i.e. set boundary to true, i.e. go only 
logically left
-               // there are some exceptions to ignore this: lineseps, 
newlines, spaces
-#if 0
-               // some effectless debug code to see the values in the debugger
-               bool bound = cur.boundary();
-               int rowpos = cur.textRow().pos();
-               int pos = cur.pos();
-               bool sep = cur.paragraph().isSeparator(cur.pos() - 1);
-               bool newline = cur.paragraph().isNewline(cur.pos() - 1);
-               bool linesep = cur.paragraph().isLineSeparator(cur.pos() - 1);
-#endif
-               if (!cur.boundary() &&
-                               cur.textRow().pos() == cur.pos() &&
-                               !cur.paragraph().isLineSeparator(cur.pos() - 1) 
&&
-                               !cur.paragraph().isNewline(cur.pos() - 1) &&
-                               !cur.paragraph().isSeparator(cur.pos() - 1)) {
-                       return setCursor(cur, cur.pit(), cur.pos(), true, true);
-               }
-               
                // go left and try to enter inset
                if (checkAndActivateInset(cur, false))
                        return false;
@@ -1041,30 +1021,6 @@
                if (checkAndActivateInset(cur, true))
                        return false;
                
-               // next position is left of boundary, 
-               // but go to next line for special cases like space, newline, 
linesep
-#if 0
-               // some effectless debug code to see the values in the debugger
-               int endpos = cur.textRow().endpos();
-               int lastpos = cur.lastpos();
-               int pos = cur.pos();
-               bool linesep = cur.paragraph().isLineSeparator(cur.pos());
-               bool newline = cur.paragraph().isNewline(cur.pos());
-               bool sep = cur.paragraph().isSeparator(cur.pos());
-               if (cur.pos() != cur.lastpos()) {
-                       bool linesep2 = 
cur.paragraph().isLineSeparator(cur.pos()+1);
-                       bool newline2 = cur.paragraph().isNewline(cur.pos()+1);
-                       bool sep2 = cur.paragraph().isSeparator(cur.pos()+1);
-               }
-#endif
-               if (cur.textRow().endpos() == cur.pos() + 1 &&
-                   cur.textRow().endpos() != cur.lastpos() &&
-                               !cur.paragraph().isNewline(cur.pos()) &&
-                               !cur.paragraph().isLineSeparator(cur.pos()) &&
-                               !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)) {

Reply via email to