case LFUN_INSET_SETTINGS: {
InsetCode code = cur.inset().lyxCode();
- if (cur.nextInset())
- code = cur.nextInset()->lyxCode();
+ if (cmd.getArg(0) == insetName(code)) {
+ flag.enabled(true);
+ break;
+ }
bool enable = false;
- switch (code) {
+ InsetCode next_code = cur.nextInset()
+ ? cur.nextInset()->lyxCode() : NO_CODE;
+ switch (next_code) {
case TABULAR_CODE:
case ERT_CODE:
case FLOAT_CODE:
case BOX_CODE:
case LISTINGS_CODE:
enable = (cmd.argument().empty() ||
- cmd.getArg(0) == insetName(code));
+ cmd.getArg(0) == insetName(next_code));
break;
default:
break;
break;
case LFUN_INSET_SETTINGS: {
- // if there is an inset at cursor, access this
- Inset * inset = cur.nextInset();
- if (inset) {
- inset->showInsetDialog(bv);
+ Inset & inset = cur.inset();
+ if (cmd.getArg(0) == insetName(inset.lyxCode())) {
+ // This inset dialog has been explicitely requested.
+ inset.showInsetDialog(bv);
+ break;
+ }
+ // else, if there is an inset at the cursor, access this
+ Inset * next_inset = cur.nextInset();
+ if (next_inset) {
+ next_inset->showInsetDialog(bv);
break;
}
- // if not work, access the underlying inset.
- cur.inset().showInsetDialog(bv);
+ // if not then access the underlying inset.
+ inset.showInsetDialog(bv);
break;
}