]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
This patch prevents the shortcut dialog from silently over-writing existing bindings...
[lyx.git] / src / LyXFunc.cpp
index 9af54af532a72252b5cb25080ceb1f48bd760b48..9e25d5c4d89f4553868b7d1dc3c72f8062e5bc39 100644 (file)
@@ -1561,20 +1561,22 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (lyx_view_ == 0)
                                break;
 
+                       // Start an undo group. This may be needed for
+                       // some stuff like inset-apply on labels.
+                       if (lyx_view_->view())
+                               view()->cursor().beginUndoGroup();
+                               
                        // Let the current LyXView dispatch its own actions.
                        if (lyx_view_->dispatch(cmd)) {
-                               if (lyx_view_->view())
+                               if (lyx_view_->view()) {
                                        updateFlags = lyx_view_->view()->cursor().result().update();
+                                       view()->cursor().endUndoGroup();
+                               }
                                break;
                        }
 
                        LASSERT(lyx_view_->view(), /**/);
 
-                       // Start an undo group. Normally, all the code
-                       // above only invoked recordUndoFullDocument,
-                       // which does not really require a group.
-                       view()->cursor().beginUndoGroup();
-
                        // Let the current BufferView dispatch its own actions.
                        if (view()->dispatch(cmd)) {
                                // The BufferView took care of its own updates if needed.
@@ -1589,10 +1591,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                                cursorPosBeforeDispatchY_);
                        view()->cursor().dispatch(cmd);
 
-                       // we assume here that the buffer view has not
-                       // changed since the beginUndoGroup.
-                       view()->cursor().endUndoGroup();
-
                        // notify insets we just left
                        if (view()->cursor() != old) {
                                old.fixIfBroken();
@@ -1601,6 +1599,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        view()->cursor().fixIfBroken();
                        }
 
+                       // we assume here that the buffer view has not
+                       // changed since the beginUndoGroup.
+                       view()->cursor().endUndoGroup();
+
                        // update completion. We do it here and not in
                        // processKeySym to avoid another redraw just for a
                        // changed inline completion