]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Hebrew translation updates by Ran
[lyx.git] / src / Text3.cpp
index eb3b7de154ecf3bb53e8ddcfc16a4abd824e5017..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);
        }
 
@@ -1360,7 +1365,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_FLEX_INSERT:
        case LFUN_BOX_INSERT:
        case LFUN_BRANCH_INSERT:
-       case LFUN_BIBITEM_INSERT:
        case LFUN_ERT_INSERT:
        case LFUN_LISTING_INSERT:
        case LFUN_MARGINALNOTE_INSERT:
@@ -1865,11 +1869,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                flag.setOnOff(cur.paragraph().params().startOfAppendix());
                break;
 
-       case LFUN_BIBITEM_INSERT:
-               enable = (cur.paragraph().layout().labeltype == LABEL_BIBLIO
-                         && cur.pos() == 0);
-               break;
-
        case LFUN_DIALOG_SHOW_NEW_INSET:
                if (cmd.argument() == "bibitem")
                        code = BIBITEM_CODE;
@@ -2122,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: