LyX crashes when backward selecting during formula writing

The problem is basically that the anchor is not set (because there is no
selection going on) and BufferView::mouseSetCursor does not handle this.

 * Cursor.cpp (anchor): return immediately when there is no selection.

 * BufferView.cpp (mouseSetCursor): reset anchor before setting cursor



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30245 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-06-23 14:54:35 +00:00
parent 7e5bdec673
commit 042c5bf425
2 changed files with 3 additions and 0 deletions

View File

@ -1920,6 +1920,7 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select)
update |= checkDepm(cur, d->cursor_);
d->cursor_.macroModeClose();
d->cursor_.resetAnchor();
d->cursor_.setCursor(cur);
d->cursor_.boundary(cur.boundary());
if (do_selection)

View File

@ -923,6 +923,8 @@ void Cursor::posVisToRowExtremity(bool left)
CursorSlice Cursor::anchor() const
{
if (!selection())
return top();
LASSERT(anchor_.depth() >= depth(), /**/);
CursorSlice normal = anchor_[depth() - 1];
if (depth() < anchor_.depth() && top() <= normal) {