break;
case LFUN_VC_REGISTER:
- enable = !buf->lyxvc().inUse();
+ enable = !buf->lyxvc().inUse() && !buf->isUnnamed();
break;
case LFUN_VC_CHECK_IN:
enable = buf->lyxvc().checkInEnabled();
// --- version control -------------------------------
case LFUN_VC_REGISTER:
LASSERT(lyx_view_ && lyx_view_->buffer(), /**/);
- if (!ensureBufferClean(view()))
+ if (!ensureBufferClean(view()) || lyx_view_->buffer()->isUnnamed())
break;
if (!lyx_view_->buffer()->lyxvc().inUse()) {
lyx_view_->buffer()->lyxvc().registrer();
}
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.
updateFlags = Update::None;
+ view()->cursor().endUndoGroup();
break;
}
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();
case LyXRC::RC_FORMAT:
case LyXRC::RC_GROUP_LAYOUTS:
case LyXRC::RC_INDEX_COMMAND:
+ case LyXRC::RC_NOMENCL_COMMAND:
case LyXRC::RC_INPUT:
case LyXRC::RC_KBMAP:
case LyXRC::RC_KBMAP_PRIMARY: