]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
Fix bug 2029 (RtL space width)
[lyx.git] / src / text2.C
index 4895962c84a40ce9bea8535d8a10aaa55bc4531d..e8001c7c7bd1dfdead898756c8b05a440739ffed 100644 (file)
@@ -494,13 +494,17 @@ void LyXText::cursorEnd(LCursor & cur)
        // the final space exept if I have a spanning inset or one string
        // is so long that we force a break.
        pos_type end = cur.textRow().endpos();
+       if (end == 0)
+               // empty text, end-1 is no valid position
+               return;
        bool boundary = false;
-       if (!cur.paragraph().isLineSeparator(end-1) &&
-           !cur.paragraph().isNewline(end-1))
-       {
-               boundary = true;
-       } else if (end != cur.lastpos())
-               --end;
+       if (end != cur.lastpos()) {
+               if (!cur.paragraph().isLineSeparator(end-1) 
+                       && !cur.paragraph().isNewline(end-1))
+                       boundary = true;
+               else
+                       --end;
+       }
        setCursor(cur, cur.pit(), end, true, boundary);
 }
 
@@ -1017,7 +1021,8 @@ bool LyXText::cursorRight(LCursor & cur)
        if (cur.pos() != cur.lastpos()) {
                bool updateNeeded = false;
                if (!checkAndActivateInset(cur, true)) {
-                       if (cur.textRow().endpos() == (cur.pos() + 1) &&
+                       if (cur.textRow().endpos() == cur.pos() + 1 &&
+                           cur.textRow().endpos() != cur.lastpos() &&
                            !cur.paragraph().isLineSeparator(cur.pos()) &&
                            !cur.paragraph().isNewline(cur.pos()))
                        {
@@ -1218,7 +1223,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
                if (old.pos() > 0
                    && old.pos() < oldpar.size()
                    && oldpar.isLineSeparator(old.pos())
-                   && oldpar.isLineSeparator(old.pos() - 1)) {
+                   && oldpar.isLineSeparator(old.pos() - 1)
+                   && oldpar.lookupChange(old.pos() - 1) != Change::DELETED) {
                        // We need to set the text to Change::INSERTED to
                        // get it erased properly
                        pars_[old.pit()].setChange(old.pos() -1,