]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
* GuiToolbar.cpp:
[lyx.git] / src / Text3.cpp
index 04d43915b1681e0f009605ffa0ccccca59df14d6..3671170eaf1007af8930085bed4db8dd1d1e64d0 100644 (file)
@@ -208,7 +208,8 @@ static bool doInsertInset(Cursor & cur, Text * text,
 
        bool gotsel = false;
        if (cur.selection()) {
-               lyx::dispatch(FuncRequest(LFUN_CUT));
+               cutSelection(cur, false, pastesel);
+               cur.clearSelection();
                gotsel = true;
        }
        text->insertInset(cur, inset);
@@ -219,7 +220,10 @@ static bool doInsertInset(Cursor & cur, Text * text,
        if (!gotsel || !pastesel)
                return true;
 
-       lyx::dispatch(FuncRequest(LFUN_PASTE, "0"));
+       pasteFromStack(cur, cur.buffer().errorList("Paste"), 0);
+       cur.buffer().errors("Paste");
+       cur.clearSelection(); // bug 393
+       cur.finishUndo();
        InsetText * insetText = dynamic_cast<InsetText *>(inset);
        if (insetText && !insetText->allowMultiPar() || cur.lastpit() == 0) {
                // reset first par to default
@@ -230,12 +234,13 @@ static bool doInsertInset(Cursor & cur, Text * text,
                // Merge multiple paragraphs -- hack
                while (cur.lastpit() > 0)
                        mergeParagraph(bparams, cur.text()->paragraphs(), 0);
+               cur.leaveInset(*inset);
        } else {
+               cur.leaveInset(*inset);
                // reset surrounding par to default
                docstring const layoutname = insetText->usePlainLayout()
                        ? bparams.documentClass().emptyLayoutName()
                        : bparams.documentClass().defaultLayoutName();
-               cur.leaveInset(*inset);
                text->setLayout(cur, layoutname);
        }
 
@@ -2116,7 +2121,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_OUTLINE_DOWN:
        case LFUN_OUTLINE_IN:
        case LFUN_OUTLINE_OUT:
-               enable = (cur.paragraph().layout().toclevel != Layout::NOT_IN_TOC);
+               // FIXME: LyX is not ready for outlining within inset.
+               enable = isMainText(cur.bv().buffer())
+                       && cur.paragraph().layout().toclevel != Layout::NOT_IN_TOC;
                break;
 
        case LFUN_NEWLINE_INSERT: