summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-09-27 00:14:58 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-09-27 00:14:58 +0000
commitb363402b5cd46132d676db33725f24c7f945ffe7 (patch)
tree51a20f2b7544fa16f92791adc5a7832e178ad009 /src
parenta3accf4bbed8229881b534c8a813b0fbea76228d (diff)
downloadirssi-b363402b5cd46132d676db33725f24c7f945ffe7.zip
/BIND <key> /command works now directly instead of needing the
"command" id in the middle git-svn-id: http://svn.irssi.org/repos/irssi/trunk@680 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/core/keyboard.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c
index aabeb525..da3718d2 100644
--- a/src/fe-common/core/keyboard.c
+++ b/src/fe-common/core/keyboard.c
@@ -315,23 +315,41 @@ static void cmd_bind(const char *data)
GHashTable *optlist;
char *key, *id, *keydata;
void *free_arg;
+ int command_id;
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST | PARAM_FLAG_OPTIONS,
"bind", &optlist, &key, &id, &keydata))
return;
if (*key != '\0' && g_hash_table_lookup(optlist, "delete")) {
- key_configure_remove(key);
- } else if (*id == '\0') {
+ /* delete key */
+ key_configure_remove(key);
+ cmd_params_free(free_arg);
+ return;
+ }
+
+ if (*id == '\0') {
/* show some/all keys */
- cmd_show_keys(key, FALSE);
- } else if (key_info_find(id) == NULL)
+ cmd_show_keys(key, FALSE);
+ cmd_params_free(free_arg);
+ return;
+ }
+
+ command_id = strchr(settings_get_str("cmdchars"), *id) != NULL;
+ if (command_id) {
+ /* using shortcut to command id */
+ keydata = g_strconcat(id, " ", keydata, NULL);
+ id = "command";
+ }
+
+ if (key_info_find(id) == NULL)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, IRCTXT_BIND_UNKNOWN_ID, id);
else {
key_configure_add(id, key, keydata);
cmd_show_keys(key, TRUE);
}
+ if (command_id) g_free(keydata);
cmd_params_free(free_arg);
}