]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Add a pending space after math if it is not the last of the selection. This fixes...
[lyx.git] / src / LyXFunc.cpp
index 2b8356a25f5a46e02cf71495222c81d2ddea3248..0c985b35ec603b3da7ab50e81597fd360f9b921b 100644 (file)
@@ -398,7 +398,22 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        //lyxerr << "LyXFunc::getStatus: cmd: " << cmd << endl;
        FuncStatus flag;
 
-       Buffer * buf = lyx_view_ ? lyx_view_->buffer() : 0;
+       /* In LyX/Mac, when a dialog is open, the menus of the
+          application can still be accessed without giving focus to
+          the main window. In this case, we want to disable the menu
+          entries that are buffer or view-related.
+
+          If this code is moved somewhere else (like in
+          GuiView::getStatus), then several functions will not be
+          handled correctly.
+       */
+       frontend::LyXView * lv = 0;
+       Buffer * buf = 0;
+       if (lyx_view_ 
+           && (cmd.origin != FuncRequest::MENU || lyx_view_->hasFocus())) {
+               lv = lyx_view_;
+               buf = lyx_view_->buffer();
+       }
 
        if (cmd.action == LFUN_NOACTION) {
                flag.message(from_utf8(N_("Nothing to do")));
@@ -473,6 +488,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        case LFUN_VC_LOCKING_TOGGLE:
                enable = !buf->isReadonly() && buf->lyxvc().lockingToggleEnabled();
+               flag.setOnOff(enable && !buf->lyxvc().locker().empty());
                break;
        case LFUN_VC_REVERT:
                enable = buf->lyxvc().inUse();
@@ -662,11 +678,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        break;
 
                // Does the view know something?
-               if (!lyx_view_) {
+               if (!lv) {
                        enable = false;
                        break;
                }
-               if (lyx_view_->getStatus(cmd, flag))
+               if (lv->getStatus(cmd, flag))
                        break;
 
                // If we do not have a BufferView, then other functions are disabled
@@ -1551,6 +1567,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
 
                case LFUN_LYXRC_APPLY: {
+                       // reset active key sequences, since the bindings
+                       // are updated (bug 6064)
+                       keyseq.reset();
                        LyXRC const lyxrc_orig = lyxrc;
 
                        istringstream ss(argument);
@@ -1707,7 +1726,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        // processKeySym to avoid another redraw just for a
                        // changed inline completion
                        if (cmd.origin == FuncRequest::KEYBOARD) {
-                               if (cmd.action == LFUN_SELF_INSERT)
+                               if (cmd.action == LFUN_SELF_INSERT
+                                   || (cmd.action == LFUN_ERT_INSERT && view()->cursor().inMathed()))
                                        lyx_view_->updateCompletion(view()->cursor(), true, true);
                                else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
                                        lyx_view_->updateCompletion(view()->cursor(), false, true);