ensure keybinding shows up in hotkeys command

not overlay
develop
myk002 2022-11-11 18:05:07 -08:00
parent aecc190b74
commit bdf201c670
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 5 additions and 4 deletions

@ -13,7 +13,7 @@ keybinding add ` gui/launcher
keybinding add Ctrl-Shift-D gui/launcher
# show hotkey popup menu
keybinding add Ctrl-Shift-C "overlay trigger hotkeys.menu"
keybinding add Ctrl-Shift-C hotkeys
# on-screen keyboard
keybinding add Ctrl-Shift-K gui/cp437-table

@ -22,6 +22,7 @@ using std::vector;
using namespace DFHack;
static const string INVOKE_MENU_COMMAND = "overlay trigger hotkeys.menu";
static const string INVOKE_HOTKEYS_COMMAND = "hotkeys";
static const std::string MENU_SCREEN_FOCUS_STRING = "dfhack/lua/hotkeys/menu";
static bool valid = false; // whether the following two vars contain valid data
@ -32,8 +33,6 @@ static vector<string> sorted_keys;
static bool can_invoke(const string &cmdline, df::viewscreen *screen) {
vector<string> cmd_parts;
split_string(&cmd_parts, cmdline, " ");
if (toLower(cmd_parts[0]) == "hotkeys")
return false;
return Core::getInstance().getPluginManager()->CanInvokeHotkey(cmd_parts[0], screen);
}
@ -56,7 +55,8 @@ static void add_binding_if_valid(const string &sym, const string &cmdline, df::v
if (!can_invoke(cmdline, screen))
return;
if (filtermenu && cmdline == INVOKE_MENU_COMMAND) {
if (filtermenu && (cmdline == INVOKE_MENU_COMMAND ||
cmdline == INVOKE_HOTKEYS_COMMAND)) {
DEBUG(log).print("filtering out hotkey menu keybinding\n");
return;
}
@ -178,6 +178,7 @@ static command_result hotkeys_cmd(color_ostream &out, vector <string> & paramete
return CR_OK;
}
// internal command -- intentionally undocumented
if (parameters.size() != 2 || parameters[0] != "invoke")
return CR_WRONG_USAGE;