]> git.lyx.org Git - features.git/blobdiff - src/Text3.cpp
Add proper extension as needed in Save as and Export
[features.git] / src / Text3.cpp
index 185008b7255197995b61405a148aa2f4bf27b251..7422bea31249a1424740c694a5ce4f10e980f00b 100644 (file)
@@ -1874,8 +1874,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                bvcur.resetAnchor();
                        if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
                                cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
-                       if (bvcur.wordSelection())
-                               selectWord(bvcur, WHOLE_WORD);
+                       // FIXME: move this to mouseSetCursor?
+                       if (bvcur.wordSelection() && bvcur.inTexted())
+                               expandWordSel(bvcur);
                        break;
 
                case mouse_button::button2:
@@ -1943,6 +1944,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // We continue with our existing selection or start a new one, so don't
                // reset the anchor.
                bvcur.setCursor(cur);
+               if (bvcur.wordSelection() && bvcur.inTexted())
+                       expandWordSel(bvcur);
                bvcur.selection(true);
                bvcur.setCurrentFont();
                if (cur.top() == old) {
@@ -3180,13 +3183,17 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_FLEX_INSERT: {
                code = FLEX_CODE;
                string s = cmd.getArg(0);
-               InsetLayout il =
-                       cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
-               if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
-                   il.lyxtype() != InsetLyXType::CUSTOM &&
-                   il.lyxtype ()!= InsetLyXType::STANDARD)
+               if (!cur.buffer()->params().documentClass().hasInsetLayout(from_utf8(s)))
                        enable = false;
-               break;
+               else {
+                       InsetLayout il =
+                               cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
+                       if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
+                               il.lyxtype() != InsetLyXType::CUSTOM &&
+                               il.lyxtype ()!= InsetLyXType::STANDARD)
+                               enable = false;
+               }
+                       break;
                }
        case LFUN_BOX_INSERT:
                code = BOX_CODE;
@@ -3565,8 +3572,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                docstring const req_layout = ignoreautonests ? from_utf8(cmd.getArg(0)) : cmd.argument();
                docstring const layout = resolveLayout(req_layout, cur);
 
-               enable = !owner_->forcePlainLayout() && !layout.empty();
-               status.setOnOff(!owner_->forcePlainLayout() && isAlreadyLayout(layout, cur));
+               // FIXME: make this work in multicell selection case
+               enable = !owner_->forcePlainLayout() && !layout.empty() && !cur.selIsMultiCell();
+               status.setOnOff(!owner_->forcePlainLayout() && !cur.selIsMultiCell()
+                               && isAlreadyLayout(layout, cur));
                break;
        }