// temporary dispatch method
void LyXFunc::miniDispatch(string const & s)
{
- if (!s.empty()) {
- dispatch(s);
+ string s2(frontStrip(strip(s)));
+
+ if (!s2.empty()) {
+ dispatch(s2);
}
}
string line = frontStrip(s);
string const arg = strip(frontStrip(split(line, cmd, ' ')));
- return dispatch(lyxaction.LookupFunc(cmd), arg);
+ int action = lyxaction.LookupFunc(cmd);
+
+ if (action == LFUN_UNKNOWN_ACTION) {
+ string const msg = string(_("Unknown function ("))
+ + cmd + ")";
+ owner->message(msg);
+ return string();
+ } else {
+ return dispatch(action, arg);
+ }
}
argument = do_not_use_this_arg; // except here
}
+
#ifdef NEW_DISPATCHER
// We try do call the most specific dispatcher first:
// 1. the lockinginset's dispatch
}
// Undo/Redo is a bit tricky for insets.
if (action == LFUN_UNDO) {
-#ifdef RETHINK_THIS_FOR_NOW_WE_LEAVE_ALL_UNLOCKED
- int slx;
- int sly;
- UpdatableInset * inset =
- owner->view()->theLockingInset()->getLockingInset();
- int inset_id = inset->id();
- inset->getCursorPos(owner->view(), slx, sly);
- owner->view()->unlockInset(inset);
-#else
- owner->view()->unlockInset(owner->view()->theLockingInset());
-#endif
owner->view()->menuUndo();
-#ifdef RETHINK_THIS_FOR_NOW_WE_LEAVE_ALL_UNLOCKED
-#if 0
- if (TEXT()->cursor.par()->
- isInset(TEXT()->cursor.pos())) {
- inset = static_cast<UpdatableInset*>(
- TEXT()->cursor.par()->
- getInset(TEXT()->
- cursor.pos()));
- } else {
- inset = 0;
- }
-#else
- inset = static_cast<UpdatableInset *>(owner->view()->buffer()->getInsetFromID(inset_id));
-#endif
- if (inset)
- inset->edit(owner->view(),slx,sly,0);
-#endif
return string();
} else if (action == LFUN_REDO) {
- int slx;
- int sly;
- UpdatableInset * inset = owner->view()->
- theLockingInset();
- inset->getCursorPos(owner->view(), slx, sly);
- owner->view()->unlockInset(inset);
owner->view()->menuRedo();
- inset = static_cast<UpdatableInset*>(
- TEXT()->cursor.par()->
- getInset(TEXT()->
- cursor.pos()));
- if (inset)
- inset->edit(owner->view(),slx,sly,0);
return string();
} else if (((result=owner->view()->theLockingInset()->
localDispatch(owner->view(), action, argument)) ==
if (!shortcuts.empty()) {
comname += ": " + shortcuts;
- } else if (!argsadded) {
+ } else if (!argsadded && !argument.empty()) {
comname += " " + argument;
}