]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Fix bug 5859.
[lyx.git] / src / LyXFunc.cpp
index b56dabbd3924c08f42b83dfc6fbec95f69b04a3a..d42b70b5b59b099c92c77563e7d3c58cf403adfe 100644 (file)
@@ -659,6 +659,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                        enable = false;
                        break;
                }
+
+               // Is this a function that acts on inset at point?
+               Inset * inset = view()->cursor().nextInset();
+               if (lyxaction.funcHasFlag(cmd.action, LyXAction::AtPoint)
+                   && inset && inset->getStatus(view()->cursor(), cmd, flag))
+                       break;
+
                if (!getLocalStatus(view()->cursor(), cmd, flag))
                        flag = view()->getStatus(cmd);
        }
@@ -1705,6 +1712,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                break;
                        }
 
+                       // Is this a function that acts on inset at point?
+                       Inset * inset = view()->cursor().nextInset();
+                       if (lyxaction.funcHasFlag(action, LyXAction::AtPoint)
+                           && inset) {
+                               view()->cursor().result().dispatched(true);
+                               view()->cursor().result().update(Update::FitCursor | Update::Force);
+                               FuncRequest tmpcmd = cmd;
+                               inset->dispatch(view()->cursor(), tmpcmd);
+                               if (view()->cursor().result().dispatched()) {
+                                       updateFlags = view()->cursor().result().update();
+                                       break;
+                               }
+                       }
+
                        // Let the current Cursor dispatch its own actions.
                        Cursor old = view()->cursor();
                        view()->cursor().getPos(cursorPosBeforeDispatchX_,