Stefan Schimanski wrote:

Am 30.05.2007 um 22:53 schrieb Dov Feldstern:

Dov Feldstern wrote:

Why should that correct? The condition will never be true because no character is newline and separator at the same time.
Hmm... right... maybe some of those should be "or"s. But obviously they're not really necessary at all... That's what I tried saying a few days ago, but I didn't then understand why...

No, something is strange here... is it possible that a the three things all evaluate to true at the same time? The fact is that they *are* taking effect in the case where there *is* a space or newline...

Yes it gives true for letter and insets (and maybe some others). But not for spaces and newlines.

Stefan

Here's another version, this time I think it at least makes sense. And it seems to work as it should.


Index: lyx-devel/src/Text2.cpp
===================================================================
--- lyx-devel.orig/src/Text2.cpp        2007-05-30 23:53:57.000000000 +0300
+++ lyx-devel/src/Text2.cpp     2007-05-31 00:00:18.000000000 +0300
@@ -1002,10 +1002,10 @@
 #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);
+                               (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() - 1, true, 
true);
                }
                
                // go left and try to enter inset
@@ -1059,9 +1059,9 @@
 #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())) {
+                               (cur.paragraph().isNewline(cur.pos() + 1) ||
+                                cur.paragraph().isLineSeparator(cur.pos() + 1) 
||
+                                cur.paragraph().isSeparator(cur.pos() + 1))) {
                        return setCursor(cur, cur.pit(), cur.pos() + 1, true, 
true);
                }
 

Reply via email to