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: {
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;
}
fixIfBroken();
FuncRequest cmd = cmd0;
Cursor safe = *this;
+
+ buffer()->undo().beginUndoGroup();
// store some values to be used inside of the handlers
beforeDispatchCursor_ = *this;
// are possible which would change it
beforeDispatchCursor_ = safe.beforeDispatchCursor_;
}
+ buffer()->undo().endUndoGroup();
}
? &(lv->documentBufferView()->buffer()) : 0;
if (doc_buffer && !theBufferList().isLoaded(doc_buffer))
doc_buffer = 0;
- // Start an undo group. This may be needed for
- // some stuff like inset-apply on labels.
- if (doc_buffer)
- doc_buffer->undo().beginUndoGroup();
// Let the current LyXView dispatch its own actions.
if (lv->dispatch(cmd)) {
BufferView * bv = lv->currentBufferView();
- if (bv) {
- Buffer * buffer = &(bv->buffer());
+ if (bv)
updateFlags = bv->cursor().result().update();
- if (buffer == doc_buffer && theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
- }
break;
}
// Let the current BufferView dispatch its own actions.
if (bv->dispatch(cmd)) {
// The BufferView took care of its own updates if needed.
- Buffer * buffer = &(bv->buffer());
updateFlags = Update::None;
- if (buffer == doc_buffer && theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
break;
}
BufferView * doc_bv = lv->documentBufferView();
// Try with the document BufferView dispatch if any.
if (doc_bv && doc_bv->dispatch(cmd)) {
- // The BufferView took care of its own updates if needed.
- Buffer * buffer = &(doc_bv->buffer());
updateFlags = Update::None;
- if (buffer == doc_buffer && theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
break;
}
if (badcursor)
bv->cursor().fixIfBroken();
}
- Buffer * buffer = &(bv->buffer());
- if (buffer == doc_buffer && theBufferList().isLoaded(buffer))
- buffer->undo().endUndoGroup();
// update completion. We do it here and not in
// processKeySym to avoid another redraw just for a