diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 5c7fd508c..732869394 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele New features:: + * core: add support of quotes in commands `/key bind` and `/key bindctxt` * core: evaluate command given to `/repeat` with contextual variables (issue #2007) * core: add option `callbacks` in command `/debug` * core: add option type "enum" (issue #1973) diff --git a/po/cs.po b/po/cs.po index a499001ce..555012fb8 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -2060,7 +2060,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/de.po b/po/de.po index 2d8a8c9e1..5a6556d4a 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-08-27 00:11+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -2562,6 +2562,75 @@ msgstr "" "unbindctxt || reset || resetctxt || " "resetall -yes [] || missing [] || legacy [...]" +#, fuzzy +#| msgid "" +#| " list: list all current keys\n" +#| "listdefault: list default keys\n" +#| " listdiff: list differences between current and default keys (keys " +#| "added, redefined or deleted)\n" +#| " context: name of context (\"default\" or \"search\")\n" +#| " bind: bind a command to a key or display command bound to key (for " +#| "context \"default\")\n" +#| " bindctxt: bind a command to a key or display command bound to key, for " +#| "given context\n" +#| " command: command (many commands can be separated by semicolons)\n" +#| " unbind: remove a key binding (for context \"default\")\n" +#| " unbindctxt: remove a key binding for given context\n" +#| " reset: reset a key to default binding (for context \"default\")\n" +#| " resetctxt: reset a key to default binding, for given context\n" +#| " resetall: restore bindings to the default values and delete ALL " +#| "personal bindings (use carefully!)\n" +#| " missing: add missing keys (using default bindings), useful after " +#| "installing new WeeChat version\n" +#| " legacy: display new name for legacy keys\n" +#| "\n" +#| "When binding a command to a key, it is recommended to use key alt+k (or " +#| "Esc then k), and then press the key to bind: this will insert key name in " +#| "command line.\n" +#| "\n" +#| "For some keys you might need to use /debug key, this displays the raw key " +#| "code that can be used (for example the key ctrl+backspace could be \"ctrl-" +#| "h\" or \"ctrl-?\", depending on your terminal and other settings).\n" +#| "\n" +#| "Modifiers allowed (in this order when multiple are used):\n" +#| " meta- (alt key)\n" +#| " ctrl- (control key)\n" +#| " shift- (shift key, can only be used with key names below)\n" +#| "\n" +#| "Key names allowed: f0 to f20, home, insert, delete, end, backspace, pgup, " +#| "pgdn, up, down, right, left, tab, return, comma, space.\n" +#| "\n" +#| "Combo of keys must be separated by a comma.\n" +#| "\n" +#| "For context \"mouse\" (possible in context \"cursor\" too), key has " +#| "format: \"@area:key\" or \"@area1>area2:key\" where area can be:\n" +#| " *: any area on screen\n" +#| " chat: chat area (any buffer)\n" +#| " chat(xxx): chat area for buffer with name \"xxx\" (full name including " +#| "plugin)\n" +#| " bar(*): any bar\n" +#| " bar(xxx): bar \"xxx\"\n" +#| " item(*): any bar item\n" +#| " item(xxx): bar item \"xxx\"\n" +#| "Wildcard \"*\" is allowed in key to match many mouse events.\n" +#| "A special value for command with format \"hsignal:name\" can be used for " +#| "context mouse, this will send the hsignal \"name\" with the focus " +#| "hashtable as argument.\n" +#| "Another special value \"-\" can be used to disable key (it will be " +#| "ignored when looking for keys).\n" +#| "\n" +#| "Examples:\n" +#| " key alt-r to jump to #weechat IRC channel:\n" +#| " /key bind meta-r /buffer #weechat\n" +#| " restore default binding for key alt-r:\n" +#| " /key reset meta-r\n" +#| " key meta-v then f1 to run /help:\n" +#| " /key bind meta-v,f1 /help\n" +#| " key \"tab\" to stop search in buffer:\n" +#| " /key bindctxt search tab /input search_stop\n" +#| " middle button of mouse on a nick to retrieve info on nick:\n" +#| " /key bindctxt mouse @item(buffer_nicklist):button3 /msg nickserv info " +#| "${nick}" msgid "" " list: list all current keys\n" "listdefault: list default keys\n" @@ -2572,7 +2641,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/es.po b/po/es.po index 74cfd649e..f300b7588 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -2560,7 +2560,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/fr.po b/po/fr.po index 6aea3c18b..f729f6844 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" -"PO-Revision-Date: 2023-08-27 11:28+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" +"PO-Revision-Date: 2023-08-27 14:12+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -2523,7 +2523,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" @@ -2593,7 +2594,8 @@ msgstr "" " bindctxt : associer une commande à une touche ou affiche la commande " "associée à la touche pour le contexte donné\n" " commande : commande (plusieurs commandes peuvent être séparées par des " -"points-virgules)\n" +"points-virgules) ; des guillemets peuvent être utilisés pour préserver les " +"espaces au début et à la fin de la commande\n" " unbind : supprimer l'association à une touche\n" " unbindctxt : supprimer l'association à une touche pour le contexte donné\n" " reset : réinitialiser une touche à son association par défaut\n" diff --git a/po/hu.po b/po/hu.po index 2edd8afd3..17ecfd46d 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1883,7 +1883,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/it.po b/po/it.po index fe6dda152..d2c936dfe 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -2147,7 +2147,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/ja.po b/po/ja.po index 5b102c189..d577dd8af 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-08-08 07:13+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -2990,7 +2990,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/pt.po b/po/pt.po index 619072f3d..c87d6ec08 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -2521,7 +2521,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/pt_BR.po b/po/pt_BR.po index c568c0fb2..604a30a32 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -2224,7 +2224,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/ru.po b/po/ru.po index 9f9ddaac2..ecb8c9767 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1906,7 +1906,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/sr.po b/po/sr.po index 4c033337f..afe09fd3e 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-08-08 07:14+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -2593,6 +2593,75 @@ msgstr "" "<контекст> <тастер> || resetall -yes [<контекст>] || missing [<контекст>] || " "legacy <тастер> [<тастер>...]" +#, fuzzy +#| msgid "" +#| " list: list all current keys\n" +#| "listdefault: list default keys\n" +#| " listdiff: list differences between current and default keys (keys " +#| "added, redefined or deleted)\n" +#| " context: name of context (\"default\" or \"search\")\n" +#| " bind: bind a command to a key or display command bound to key (for " +#| "context \"default\")\n" +#| " bindctxt: bind a command to a key or display command bound to key, for " +#| "given context\n" +#| " command: command (many commands can be separated by semicolons)\n" +#| " unbind: remove a key binding (for context \"default\")\n" +#| " unbindctxt: remove a key binding for given context\n" +#| " reset: reset a key to default binding (for context \"default\")\n" +#| " resetctxt: reset a key to default binding, for given context\n" +#| " resetall: restore bindings to the default values and delete ALL " +#| "personal bindings (use carefully!)\n" +#| " missing: add missing keys (using default bindings), useful after " +#| "installing new WeeChat version\n" +#| " legacy: display new name for legacy keys\n" +#| "\n" +#| "When binding a command to a key, it is recommended to use key alt+k (or " +#| "Esc then k), and then press the key to bind: this will insert key name in " +#| "command line.\n" +#| "\n" +#| "For some keys you might need to use /debug key, this displays the raw key " +#| "code that can be used (for example the key ctrl+backspace could be \"ctrl-" +#| "h\" or \"ctrl-?\", depending on your terminal and other settings).\n" +#| "\n" +#| "Modifiers allowed (in this order when multiple are used):\n" +#| " meta- (alt key)\n" +#| " ctrl- (control key)\n" +#| " shift- (shift key, can only be used with key names below)\n" +#| "\n" +#| "Key names allowed: f0 to f20, home, insert, delete, end, backspace, pgup, " +#| "pgdn, up, down, right, left, tab, return, comma, space.\n" +#| "\n" +#| "Combo of keys must be separated by a comma.\n" +#| "\n" +#| "For context \"mouse\" (possible in context \"cursor\" too), key has " +#| "format: \"@area:key\" or \"@area1>area2:key\" where area can be:\n" +#| " *: any area on screen\n" +#| " chat: chat area (any buffer)\n" +#| " chat(xxx): chat area for buffer with name \"xxx\" (full name including " +#| "plugin)\n" +#| " bar(*): any bar\n" +#| " bar(xxx): bar \"xxx\"\n" +#| " item(*): any bar item\n" +#| " item(xxx): bar item \"xxx\"\n" +#| "Wildcard \"*\" is allowed in key to match many mouse events.\n" +#| "A special value for command with format \"hsignal:name\" can be used for " +#| "context mouse, this will send the hsignal \"name\" with the focus " +#| "hashtable as argument.\n" +#| "Another special value \"-\" can be used to disable key (it will be " +#| "ignored when looking for keys).\n" +#| "\n" +#| "Examples:\n" +#| " key alt-r to jump to #weechat IRC channel:\n" +#| " /key bind meta-r /buffer #weechat\n" +#| " restore default binding for key alt-r:\n" +#| " /key reset meta-r\n" +#| " key meta-v then f1 to run /help:\n" +#| " /key bind meta-v,f1 /help\n" +#| " key \"tab\" to stop search in buffer:\n" +#| " /key bindctxt search tab /input search_stop\n" +#| " middle button of mouse on a nick to retrieve info on nick:\n" +#| " /key bindctxt mouse @item(buffer_nicklist):button3 /msg nickserv info " +#| "${nick}" msgid "" " list: list all current keys\n" "listdefault: list default keys\n" @@ -2603,7 +2672,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/tr.po b/po/tr.po index d2925bfe5..97320bd29 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2023-08-08 07:14+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -2610,7 +2610,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/po/weechat.pot b/po/weechat.pot index 6946f283d..e7366e03b 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-27 11:25+0200\n" +"POT-Creation-Date: 2023-08-27 14:12+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -1741,7 +1741,8 @@ msgid "" "context \"default\")\n" " bindctxt: bind a command to a key or display command bound to key, for " "given context\n" -" command: command (many commands can be separated by semicolons)\n" +" command: command (many commands can be separated by semicolons); quotes " +"can be used to preserve spaces at the beginning/end of command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context \"default\")\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 3ef54144b..113debad7 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -4106,7 +4106,7 @@ COMMAND_CALLBACK(key) { struct t_gui_key *ptr_new_key; int i, old_keys_count, keys_added, context, rc; - char *key_name; + char *key_name, *value; /* make C compiler happy */ (void) pointer; @@ -4197,8 +4197,14 @@ COMMAND_CALLBACK(key) } gui_key_verbose = 1; - (void) gui_key_bind (NULL, GUI_KEY_CONTEXT_DEFAULT, - argv[2], argv_eol[3], 1); + value = string_remove_quotes (argv_eol[3], "'\""); + (void) gui_key_bind (NULL, /* buffer */ + GUI_KEY_CONTEXT_DEFAULT, + argv[2], + (value) ? value : argv_eol[3], + 1); /* check_key */ + if (value) + free (value); gui_key_verbose = 0; return WEECHAT_RC_OK; @@ -4239,7 +4245,14 @@ COMMAND_CALLBACK(key) } gui_key_verbose = 1; - gui_key_bind (NULL, context, argv[3], argv_eol[4], 1); + value = string_remove_quotes (argv_eol[4], "'\""); + gui_key_bind (NULL, /* buffer */ + context, + argv[3], + (value) ? value : argv_eol[4], + 1); /* check_key */ + if (value) + free (value); gui_key_verbose = 0; return WEECHAT_RC_OK; @@ -8667,7 +8680,9 @@ command_init () "key (for context \"default\")\n" " bindctxt: bind a command to a key or display command bound to " "key, for given context\n" - " command: command (many commands can be separated by semicolons)\n" + " command: command (many commands can be separated by semicolons); " + "quotes can be used to preserve spaces at the beginning/end of " + "command\n" " unbind: remove a key binding (for context \"default\")\n" " unbindctxt: remove a key binding for given context\n" " reset: reset a key to default binding (for context "