From: Jürgen Spitzmüller Date: Sat, 21 Jan 2012 17:16:56 +0000 (+0000) Subject: Fix crash when putting a float around multiple display maths (bug #7974). X-Git-Tag: 2.0.3~62 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9cb532913b410698a3fce4f1bef1f3363e7b3653;p=features.git 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 --- diff --git a/src/Text3.cpp b/src/Text3.cpp index 9830f8a026..5865afd22b 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1648,16 +1648,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case LFUN_FLOAT_INSERT: case LFUN_FLOAT_WIDE_INSERT: case LFUN_WRAP_INSERT: { - // will some text be moved into the inset? - bool content = cur.selection(); + // will some content be moved into the inset? + 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); cur.posForward(); - // If some text is moved into the inset, doInsertInset - // puts the cursor outside the inset. To insert the - // caption we put it back into the inset. - if (content) + // If some single-par content is moved into the inset, + // doInsertInset puts the cursor outside the inset. + // To insert the caption we put it back into the inset. + // FIXME cleanup doInsertInset to avoid such dances! + if (content && singlepar) cur.backwardPos(); ParagraphList & pars = cur.text()->paragraphs(); diff --git a/status.20x b/status.20x index 959bfb2480..4cdb9cc80f 100644 --- a/status.20x +++ b/status.20x @@ -174,6 +174,8 @@ What's new - Fix crash when performing "forward search" while cursor is in mathed (bug 7992). +- Fix crash when inserting a float around multiple display maths (bug 7974). + - Update citation labels when the BibTeX file changes (bug 7499). - Mark Buffer dirty when changing branch activation status (bug 7872). Sadly,