]> git.lyx.org Git - features.git/commitdiff
Two small fixes with right cursor settings.
authorJürgen Vigna <jug@sad.it>
Thu, 2 May 2002 12:45:27 +0000 (12:45 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 2 May 2002 12:45:27 +0000 (12:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4116 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 2dbbf8630c4b1952ccc5020b45a64cc6c405c2ea..95617f0d30e2650e7cf94a8b1576ba4bfd4ce3b7 100644 (file)
@@ -1,5 +1,10 @@
 2002-05-02  Juergen Vigna  <jug@sad.it>
 
+       * text2.C (fixCursorAfterDelete): check to make sure we don't request
+       to set the cursor behind the pargraph with > size().
+       (setCursor): check also for the same paragraph when checking where
+       to put the cursor if we have a NFR inset.
+
        * buffer.C (parseSingleLyXformat2Token): move the compatibility
        parts of layout read further up as it still was in the wrong
        position.
index 71f861cc8124604459edc73a46d7ce14f1f9cda5..ba98a27f323d1b7cbc6b86424ee1a4bee7a37fda 100644 (file)
@@ -2072,6 +2072,7 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par,
        cur.iy(y + row->baseline());
        Inset * ins;
        if (row->previous() && pos &&
+               row->previous()->par() == row->par() &&
                par->getChar(pos) == Paragraph::META_INSET &&
                (ins=par->getInset(pos)) && (ins->needFullRow() || ins->display()))
        {
@@ -2404,6 +2405,11 @@ void LyXText::fixCursorAfterDelete(BufferView * bview,
        if (cur.pos() > where.pos())
                cur.pos(cur.pos()-1);
 
+       // check also if we don't want to set the cursor on a spot behind the
+       // pagragraph because we erased the last character.
+       if (cur.pos() > cur.par()->size())
+               cur.pos(cur.par()->size());
+       
        // recompute row et al. for this cursor
        setCursor(bview, cur, cur.par(), cur.pos(), cur.boundary());
 }