Fix crash when putting a float around multiple display maths (bug #7974).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40644 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2012-01-21 17:16:56 +00:00
parent 5e1ec87fff
commit 9cb532913b
2 changed files with 11 additions and 6 deletions

View File

@ -1648,16 +1648,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_FLOAT_INSERT: case LFUN_FLOAT_INSERT:
case LFUN_FLOAT_WIDE_INSERT: case LFUN_FLOAT_WIDE_INSERT:
case LFUN_WRAP_INSERT: { case LFUN_WRAP_INSERT: {
// will some text be moved into the inset? // will some content be moved into the inset?
bool content = cur.selection(); bool const content = cur.selection();
// does the content consist of multiple paragraphs?
bool const singlepar = (cur.selBegin().pit() == cur.selEnd().pit());
doInsertInset(cur, this, cmd, true, true); doInsertInset(cur, this, cmd, true, true);
cur.posForward(); cur.posForward();
// If some text is moved into the inset, doInsertInset // If some single-par content is moved into the inset,
// puts the cursor outside the inset. To insert the // doInsertInset puts the cursor outside the inset.
// caption we put it back into the inset. // To insert the caption we put it back into the inset.
if (content) // FIXME cleanup doInsertInset to avoid such dances!
if (content && singlepar)
cur.backwardPos(); cur.backwardPos();
ParagraphList & pars = cur.text()->paragraphs(); ParagraphList & pars = cur.text()->paragraphs();

View File

@ -174,6 +174,8 @@ What's new
- Fix crash when performing "forward search" while cursor is in mathed - Fix crash when performing "forward search" while cursor is in mathed
(bug 7992). (bug 7992).
- Fix crash when inserting a float around multiple display maths (bug 7974).
- Update citation labels when the BibTeX file changes (bug 7499). - Update citation labels when the BibTeX file changes (bug 7499).
- Mark Buffer dirty when changing branch activation status (bug 7872). Sadly, - Mark Buffer dirty when changing branch activation status (bug 7872). Sadly,