]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
A couple comments and some very minor cleanup.
[lyx.git] / src / BufferView.cpp
index 3f35b90ee5b372f8afb31bd7f4b356e05329518b..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: {
@@ -1865,24 +1870,24 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                        break;
                }
                // put cursor in front of inset.
-               if (!setCursorFromInset(inset))
+               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;
 }
 
 
@@ -1945,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;