summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNils Görs <weechatter@arcor.de>2012-12-25 10:54:51 +0100
committerSebastien Helleu <flashcode@flashtux.org>2012-12-25 10:54:51 +0100
commit67a111f7f2fbda37c464dff943c9e07d29fea1f2 (patch)
tree96050bc05e4d81262f0c3bfc0f79ef2ac506d4d0 /src/core
parentcf76379aa96a4df0677f1d1485d38225a3d79c95 (diff)
downloadweechat-67a111f7f2fbda37c464dff943c9e07d29fea1f2.zip
core: fix detection of command in input: a single command char is considered as a command (API function "string_input_for_bufer")
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-string.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index d6474af15..c61918a85 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -1989,7 +1989,7 @@ string_input_for_buffer (const char *string)
pos_space = strchr (string + 1, ' ');
/*
- * if there's no other '/' of if '/' is after first space,
+ * if there's no other '/' or if '/' is after first space,
* then it is a command, and return NULL
*/
if (!pos_slash || (pos_space && pos_slash > pos_space))
@@ -2002,10 +2002,13 @@ string_input_for_buffer (const char *string)
if (!string_is_command_char (string))
return string;
- /* check if first char is doubled: if yes, then it's not a command */
next_char = utf8_next_char (string);
+
+ /* there's no next char, then it's a command */
if (!next_char || !next_char[0])
- return string;
+ return NULL;
+
+ /* check if first char is doubled: if yes, then it's not a command */
if (utf8_charcmp (string, next_char) == 0)
return next_char;