support backtick as a keybinding

and bind it to gui/launcher
develop
myk002 2022-07-11 17:23:56 -07:00
parent a5da3c18f9
commit 328d839f19
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
3 changed files with 7 additions and 2 deletions

@ -8,6 +8,8 @@
# Generic dwarfmode bindings # # Generic dwarfmode bindings #
############################## ##############################
keybinding add ` gui/launcher
# show all current key bindings # show all current key bindings
keybinding add Ctrl-F1 hotkeys keybinding add Ctrl-F1 hotkeys
keybinding add Alt-F1 hotkeys keybinding add Alt-F1 hotkeys

@ -107,8 +107,8 @@ To set keybindings, use the built-in ``keybinding`` command. Like any other
command it can be used at any time from the console, but bindings are not command it can be used at any time from the console, but bindings are not
remembered between runs of the game unless re-created in `dfhack.init`. remembered between runs of the game unless re-created in `dfhack.init`.
Currently, any combinations of Ctrl/Alt/Shift with A-Z, 0-9, or F1-F12 are Currently, any combinations of Ctrl/Alt/Shift with A-Z, 0-9, F1-F12, or ``\```
supported. are supported.
Possible ways to call the command: Possible ways to call the command:

@ -2558,6 +2558,9 @@ static bool parseKeySpec(std::string keyspec, int *psym, int *pmod, std::string
if (keyspec.size() == 1 && keyspec[0] >= 'A' && keyspec[0] <= 'Z') { if (keyspec.size() == 1 && keyspec[0] >= 'A' && keyspec[0] <= 'Z') {
*psym = SDL::K_a + (keyspec[0]-'A'); *psym = SDL::K_a + (keyspec[0]-'A');
return true; return true;
} else if (keyspec.size() == 1 && keyspec[0] == '`') {
*psym = SDL::K_BACKQUOTE;
return true;
} else if (keyspec.size() == 1 && keyspec[0] >= '0' && keyspec[0] <= '9') { } else if (keyspec.size() == 1 && keyspec[0] >= '0' && keyspec[0] <= '9') {
*psym = SDL::K_0 + (keyspec[0]-'0'); *psym = SDL::K_0 + (keyspec[0]-'0');
return true; return true;