]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Try to deal with one of the big problems here, namely, that we
[lyx.git] / src / BufferView.cpp
index 46b3e079b451d3fba7010efde633d895f593119d..70ce4b8ce5738897b7a0e8c4fa2dc59b7ea52e62 100644 (file)
@@ -1214,6 +1214,11 @@ bool BufferView::dispatch(FuncRequest const & cmd)
        if (buffer_.isInternal() && lyxaction.funcHasFlag(cmd.action, LyXAction::NoInternal))
                return false;
 
+       // We'll set this back to false if need be.
+       bool dispatched = true;
+       if (cmd.action != LFUN_UNDO && cmd.action != LFUN_REDO)
+               buffer_.undo().beginUndoGroup();
+
        switch (cmd.action) {
 
        case LFUN_BUFFER_PARAMS_APPLY: {
@@ -1868,22 +1873,21 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                if (!setCursorFromInset(inset)) {
                        LASSERT(false, break);
                }
-               // useful if we are called from a dialog.
-               cur.beginUndoGroup();
                cur.recordUndo();
                FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument());
                inset->dispatch(cur, fr);
-               cur.endUndoGroup();
                processUpdateFlags(Update::SinglePar | Update::FitCursor);
                break;
        }
 
-
        default:
-               return false;
+               dispatched = false;
+               break;
        }
 
-       return true;
+       if (cmd.action != LFUN_UNDO && cmd.action != LFUN_REDO)
+               buffer_.undo().endUndoGroup();
+       return dispatched;
 }
 
 
@@ -1946,7 +1950,7 @@ Inset const * BufferView::getCoveringInset(Text const & text,
        if (!inset)
                return 0;
 
-       if (!inset->descendable())
+       if (!inset->descendable(*this))
                // No need to go further down if the inset is not
                // descendable.
                return inset;