]> git.lyx.org Git - features.git/commitdiff
Fix crash when putting a float around multiple display maths (bug #7974).
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 21 Jan 2012 17:16:56 +0000 (17:16 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 21 Jan 2012 17:16:56 +0000 (17:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40644 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text3.cpp
status.20x

index 9830f8a0269db04b60bf1dc8e355ec16c63413da..5865afd22bdbff4f0b58346d4753bdec2d4c24bd 100644 (file)
@@ -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();
index 959bfb248070e2c4b889598e11609ace4f331a55..4cdb9cc80f05ba3da1def261f5bf49212f9b1778 100644 (file)
@@ -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,