summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/core/wee-string.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 64c193783..36835355b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,14 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.4.0-dev, 2012-12-24
+v0.4.0-dev, 2012-12-25
Version 0.4.0 (under dev!)
--------------------------
+* core: fix detection of command in input: a single command char is considered
+ as a command (API function "string_input_for_bufer")
* core: search for a fallback template when a no template is matching command
arguments
* core: add option "diff" for command /set (list options with changed value)
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;