]> 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 f871bb31d157c1b1a91371428be779b2774ebb21..7422bea31249a1424740c694a5ce4f10e980f00b 100644 (file)
@@ -1875,17 +1875,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
                                cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
                        // FIXME: move this to mouseSetCursor?
-                       if (bvcur.wordSelection() && bvcur.inTexted()) {
-                               // select word around new position
-                               Cursor c = bvcur;
-                               c.selection(false);
-                               c.text()->selectWord(c, WHOLE_WORD);
-                               // use the correct word boundary, depending on selection direction
-                               if (bvcur.top() > bvcur.normalAnchor())
-                                       bvcur.pos() = c.selEnd().pos();
-                               else
-                                       bvcur.pos() = c.selBegin().pos();
-                       }
+                       if (bvcur.wordSelection() && bvcur.inTexted())
+                               expandWordSel(bvcur);
                        break;
 
                case mouse_button::button2:
@@ -1953,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) {
@@ -3190,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;
@@ -3575,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;
        }