// inset (depending on cmd.x(), cmd.y()). This is needed for
// editing to fix bug 9628, but e.g. the context menu needs a
// cursor in front of the inset.
- if (inset->hasSettings() &&
+ if ((inset->hasSettings() || !inset->contextMenuName().empty()) &&
cur.nextInset() != inset && cur.prevInset() == inset)
cur.posBackward();
}
if (!inset || !cur.result().dispatched())
cur.dispatch(cmd);
- cur.endUndoGroup();
-
// Notify left insets
if (cur != old) {
bool badcursor = old.fixIfBroken() | cur.fixIfBroken();
cursor().fixIfBroken();
}
+ cur.endUndoGroup();
+
// Do we have a selection?
theSelection().haveSelection(cursor().selection());
bool update = leftinset;
if (!do_selection && d->cursor_.inTexted()) {
update |= checkDepm(cur, d->cursor_);
- if (cur.pos() && cur.paragraph().isEnvSeparator(cur.pos() - 1))
+ if (cur.inTexted() && cur.pos()
+ && cur.paragraph().isEnvSeparator(cur.pos() - 1))
cur.posBackward();
}