Two small fixes with right cursor settings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4116 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-05-02 12:45:27 +00:00
parent 8d4e2f31c4
commit 025a1ad106
2 changed files with 11 additions and 0 deletions

View 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.

View 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());
}