]> git.lyx.org Git - features.git/commitdiff
Add empty paragraphs before and after the caption inset upon float (or wrap) inset...
authorAbdelrazak Younes <younes@lyx.org>
Thu, 1 Feb 2007 09:22:03 +0000 (09:22 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 1 Feb 2007 09:22:03 +0000 (09:22 +0000)
Hopefully fix bug 675:

http://bugzilla.lyx.org/show_bug.cgi?id=675

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16999 a592a061-630c-0410-9148-cb99ea01b6c8

src/text3.C

index 7d4b85524ca2a7746c0867a9882b78ae967ebf16..f42bfb20f85af8b99004e70a8040c49017c67455 100644 (file)
@@ -1134,9 +1134,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                doInsertInset(cur, this, cmd, true, true);
                cur.posRight();
                updateLabels(*bv->buffer());
-               // FIXME: We should insert two empty paragraphs before and
-               // after the caption so that the user can go up or down in
-               // order to insert a figure or a table.
                break;
        case LFUN_NOTE_INSERT:
        case LFUN_CHARSTYLE_INSERT:
@@ -1165,11 +1162,24 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_FLOAT_INSERT:
        case LFUN_FLOAT_WIDE_INSERT:
-       case LFUN_WRAP_INSERT:
+       case LFUN_WRAP_INSERT: {
                doInsertInset(cur, this, cmd, true, true);
                cur.posRight();
+               ParagraphList & pars = cur.text()->paragraphs();
+               // We create two additional empty paragraphs so that the
+               // user can choose where to put the graphics (or table).
+               pars.push_back(pars[0]);
+               pars.push_back(pars[0]);
+               // Now that we have three paragraphs, we reposition the cursor
+               // at the beginning of the second one.
+               cur.pit() = 1;
+               cur.pos() = 0;
                cur.dispatch(FuncRequest(LFUN_CAPTION_INSERT));
+               // FIXME: When leaving the Float (or Wrap) inset we should
+               // any empty paragraph left above or below the
+               // caption.
                break;
+       }
 
        case LFUN_INDEX_INSERT:
        case LFUN_NOMENCL_INSERT: {