[visual cursor] Crash when cutting a figure caption and moving the cursor.

Avoid negative positions.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28629 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-02-26 21:29:19 +00:00
parent 4b775f5393
commit f03d2fb6ef

View File

@ -644,7 +644,7 @@ void Cursor::getSurroundingPos(pos_type & left_pos, pos_type & right_pos)
// The cursor is painted *before* the character at pos(), or, if 'boundary'
// is true, *after* the character at (pos() - 1). So we already have one
// known position around the cursor:
pos_type known_pos = boundary() ? pos() - 1 : pos();
pos_type known_pos = boundary() && pos() > 0 ? pos() - 1 : pos();
// edge case: if we're at the end of the paragraph, things are a little
// different (because lastpos is a position which does not really "exist"