case LFUN_SCREEN_RECENTER:
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
- case LFUN_GRAPHICS_GROUPS_UNIFY:
case LFUN_NOTES_MUTATE:
case LFUN_ALL_INSETS_TOGGLE:
case LFUN_STATISTICS:
FuncRequest req = cmd;
if (cmd.argument().empty() && !d->search_request_cache_.argument().empty())
req = d->search_request_cache_;
+ if (req.argument().empty()) {
+ theLyXFunc().dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
+ break;
+ }
if (find(this, req))
showCursor();
else
case LFUN_MARK_ON:
cur.clearSelection();
- cur.mark() = true;
+ cur.setMark(true);
cur.resetAnchor();
cur.message(from_utf8(N_("Mark on")));
break;
case LFUN_MARK_TOGGLE:
cur.clearSelection();
if (cur.mark()) {
- cur.mark() = false;
+ cur.setMark(false);
cur.message(from_utf8(N_("Mark removed")));
} else {
- cur.mark() = true;
+ cur.setMark(true);
cur.message(from_utf8(N_("Mark set")));
}
cur.resetAnchor();
processUpdateFlags(Update::Force);
break;
- // These two could be rewriten using some command like forall <insetname> <command>
+ // This could be rewriten using some command like forall <insetname> <command>
// once the insets refactoring is done.
- case LFUN_GRAPHICS_GROUPS_UNIFY: {
- if (cmd.argument().empty())
- break;
- graphics::unifyGraphicsGroups(cur.buffer(), to_utf8(cmd.argument()));
- processUpdateFlags(Update::Force | Update::FitCursor);
- break;
- }
-
case LFUN_NOTES_MUTATE: {
if (cmd.argument().empty())
break;
Cursor old = cursor();
Cursor cur(*this);
cur.push(buffer_.inset());
- cur.selection() = d->cursor_.selection();
+ cur.setSelection(d->cursor_.selection());
// Either the inset under the cursor or the
// surrounding Text will handle this event.
// Put anchor at the same position.
cur.resetAnchor();
+ cur.beginUndoGroup();
+
// Try to dispatch to an non-editable inset near this position
// via the temp cursor. If the inset wishes to change the real
// cursor it has to do so explicitly by using
if (!inset || !cur.result().dispatched())
cur.dispatch(cmd);
+ cur.endUndoGroup();
+
// Notify left insets
if (cur != old) {
old.fixIfBroken();
bool BufferView::setCursorFromInset(Inset const * inset)
{
// are we already there?
- if (cursor().nextInset() == inset)
+ if (&cursor().inset() == inset || cursor().nextInset() == inset)
return true;
// Inset is not at cursor position. Find it in the document.
dit[i].inset().edit(d->cursor_, true);
d->cursor_.setCursor(dit);
- d->cursor_.selection() = false;
+ d->cursor_.setSelection(false);
}