-
- // we have not done anything wrong yet.
- errorstat = false;
- dispatch_buffer.erase();
-
- // if action is a pseudo-action, we need the real action
- if (lyxaction.isPseudoAction(ac)) {
- string tmparg;
- action = static_cast<kb_action>
- (lyxaction.retrieveActionArg(ac, tmparg));
- if (!tmparg.empty())
- argument = tmparg;
+
+ // get the real action and argument
+ action = lyxaction.retrieveActionArg(ac, argument);
+
+ verboseDispatch(action, argument, show_sc);
+}
+
+
+
+void LyXFunc::verboseDispatch(kb_action action,
+ string const & argument, bool show_sc)
+{
+ string res = dispatch(action, argument);
+
+ commandshortcut.erase();
+
+ if (lyxrc.display_shortcuts && show_sc) {
+ if (action != LFUN_SELFINSERT) {
+ // Put name of command and list of shortcuts
+ // for it in minibuffer
+ string comname = lyxaction.getActionName(action);
+
+ int pseudoaction = action;
+ bool argsadded = false;
+
+ if (!argument.empty()) {
+ // the pseudoaction is useful for the bindings
+ pseudoaction =
+ lyxaction.searchActionArg(action,
+ argument);
+
+ if (pseudoaction == LFUN_UNKNOWN_ACTION) {
+ pseudoaction = action;
+ } else {
+ comname += " " + argument;
+ argsadded = true;
+ }
+ }
+
+ string const shortcuts =
+ toplevel_keymap->findbinding(pseudoaction);
+
+ if (!shortcuts.empty()) {
+ comname += ": " + shortcuts;
+ } else if (!argsadded && !argument.empty()) {
+ comname += " " + argument;
+ }
+
+ if (!comname.empty()) {
+ comname = strip(comname);
+ commandshortcut = "(" + comname + ')';
+ }
+ }
+ }
+
+ if (res.empty()) {
+ if (!commandshortcut.empty()) {
+ owner->getMiniBuffer()->addSet(commandshortcut);
+ }