break;
}
- case LFUN_NEXT_INSET_TOGGLE:
case LFUN_NEXT_INSET_MODIFY: {
// this is the real function we want to invoke
FuncRequest tmpcmd = cmd;
- tmpcmd.action = (cmd.action == LFUN_NEXT_INSET_TOGGLE)
- ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY;
+ tmpcmd.action = LFUN_INSET_MODIFY;
// if there is an inset at cursor, see whether it
// handles the lfun, other start from scratch
Inset * inset = cur.nextInset();
case LFUN_BRANCH_ACTIVATE:
case LFUN_BRANCH_DEACTIVATE: {
- bool enable = false;
+ BranchList const & branchList = buffer_.params().branchlist();
docstring const branchName = cmd.argument();
- if (!branchName.empty())
- enable = buffer_.params().branchlist().find(branchName);
- flag.setEnabled(enable);
+ flag.setEnabled(!branchName.empty()
+ && branchList.find(branchName));
break;
}
processUpdateFlags(Update::SinglePar | Update::FitCursor);
break;
}
- case LFUN_NEXT_INSET_TOGGLE: {
- // create the the real function we want to invoke
- FuncRequest tmpcmd = cmd;
- tmpcmd.action = LFUN_INSET_TOGGLE;
- // if there is an inset at cursor, see whether it
- // wants to toggle.
- Inset * inset = cur.nextInset();
- if (inset) {
- if (inset->isActive()) {
- Cursor tmpcur = cur;
- tmpcur.pushBackward(*inset);
- inset->dispatch(tmpcur, tmpcmd);
- if (tmpcur.result().dispatched())
- cur.dispatched();
- } else
- inset->dispatch(cur, tmpcmd);
- }
- // if it did not work, try the underlying inset.
- if (!inset || !cur.result().dispatched())
- cur.dispatch(tmpcmd);
-
- if (!cur.result().dispatched())
- // It did not work too; no action needed.
- break;
- cur.clearSelection();
- processUpdateFlags(Update::SinglePar | Update::FitCursor);
- break;
- }
-
case LFUN_NEXT_INSET_MODIFY: {
// create the the real function we want to invoke
FuncRequest tmpcmd = cmd;
case LFUN_BRANCH_ACTIVATE:
case LFUN_BRANCH_DEACTIVATE:
+ if (cmd.argument().empty())
+ return false;
buffer_.dispatch(cmd);
processUpdateFlags(Update::Force);
break;