get rid of a crash

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9702 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2005-03-07 15:27:51 +00:00
parent 847afab142
commit aaca522459
3 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2005-03-07 Alfredo Braunstein <abraunst@lyx.org>
* text2.C (cursorUp): get rid of a crash
* text.C (x2pos): add an assert
2005-03-07 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfunc.C (getStatus): fix warning when assertions are disabled

View File

@ -2215,6 +2215,7 @@ string LyXText::getPossibleLabel(LCursor & cur) const
pos_type LyXText::x2pos(pit_type pit, int row, int x) const
{
BOOST_ASSERT(row < pars_[pit].rows().size());
bool bound = false;
Row const & r = pars_[pit].rows()[row];
return r.pos() + getColumnNearX(pit, r, x, bound);

View File

@ -987,8 +987,8 @@ bool LyXText::cursorUp(LCursor & cur)
x2pos(cur.pit(), row - 1, x));
} else if (cur.pit() > 0) {
--cur.pit();
updateNeeded |= setCursor(cur, cur.pit(),
x2pos(cur.pit(), par.rows().size() - 1, x));
//cannot use 'par' now
updateNeeded |= setCursor(cur, cur.pit(), x2pos(cur.pit(), cur.paragraph().rows().size() - 1, x));
}
cur.x_target() = x;