summaryrefslogtreecommitdiff
path: root/src/gui/gui-keyboard.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-07-12 15:00:45 +0000
committerSebastien Helleu <flashcode@flashtux.org>2007-07-12 15:00:45 +0000
commit241f70f869c9d04ad13fdaa8b53ba57067426e8b (patch)
tree84c615ab66fb2b90eeabefcf7360fe9eb3db63ee /src/gui/gui-keyboard.c
parent9d5ef17bd66a91b8023e428e316d039e31f5f858 (diff)
downloadweechat-241f70f869c9d04ad13fdaa8b53ba57067426e8b.zip
Fixed bugs with IRC color in messages, now color codes are inserted in command line with ^Cc,^Cb,.. instead of %C,%B,.. (bug #20222, task #7060)
Diffstat (limited to 'src/gui/gui-keyboard.c')
-rw-r--r--src/gui/gui-keyboard.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index ea8bd272c..05ddd3b69 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -469,7 +469,7 @@ gui_keyboard_bind (char *key, char *command)
{
t_gui_key_func *ptr_function;
t_gui_key *new_key;
- char *ptr_args;
+ char *command2, *ptr_args;
if (!key || !command)
{
@@ -480,18 +480,24 @@ gui_keyboard_bind (char *key, char *command)
ptr_function = NULL;
ptr_args = NULL;
+
if (command[0] != '/')
{
ptr_args = strchr (command, ' ');
if (ptr_args)
- ptr_args[0] = '\0';
- ptr_function = gui_keyboard_function_search_by_name (command);
- if (ptr_args)
+ command2 = strndup (command, ptr_args - command);
+ else
+ command2 = strdup (command);
+ if (command2)
{
- ptr_args[0] = ' ';
- ptr_args++;
- while (ptr_args[0] == ' ')
+ ptr_function = gui_keyboard_function_search_by_name (command2);
+ if (ptr_args)
+ {
ptr_args++;
+ while (ptr_args[0] == ' ')
+ ptr_args++;
+ }
+ free (command2);
}
if (!ptr_function)
{