1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

core: fix execution of multiple commands separated by newline when there are no spaces

For example typing this on core buffer:

/t1
/t2

was not executing the two commands but sent the text to the buffer instead.

This is because WeeChat thinks it's a path, and the newline should indicate
it's not (like a space before the next slash: "/t1 /t2" is a command, not a
path, but "/t1/t2" is considered a path).
This commit is contained in:
Sébastien Helleu
2023-05-05 20:28:11 +02:00
parent 25d7192677
commit 6d7f10ef20
2 changed files with 30 additions and 4 deletions
+22
View File
@@ -2490,6 +2490,7 @@ TEST(CoreString, InputForBuffer)
POINTERS_EQUAL(NULL, string_input_for_buffer ("/"));
POINTERS_EQUAL(NULL, string_input_for_buffer ("/abc"));
/* not commands */
str = strdup ("");
STRCMP_EQUAL(str, string_input_for_buffer (str));
free (str);
@@ -2511,6 +2512,27 @@ TEST(CoreString, InputForBuffer)
str = strdup ("//abc");
STRCMP_EQUAL(str + 1, string_input_for_buffer (str));
free (str);
str = strdup ("/abc/def /ghi");
STRCMP_EQUAL(str, string_input_for_buffer (str));
free (str);
str = strdup ("/abc/def /ghi");
STRCMP_EQUAL(str, string_input_for_buffer (str));
free (str);
/* commands */
POINTERS_EQUAL(NULL, string_input_for_buffer (NULL));
str = strdup ("/");
POINTERS_EQUAL(NULL, string_input_for_buffer (str));
free (str);
str = strdup ("/abc");
POINTERS_EQUAL(NULL, string_input_for_buffer (str));
free (str);
str = strdup ("/abc /def");
POINTERS_EQUAL(NULL, string_input_for_buffer (str));
free (str);
str = strdup ("/abc\n/def");
POINTERS_EQUAL(NULL, string_input_for_buffer (str));
free (str);
/* test with custom command chars */
config_file_option_set (config_look_command_chars, "öï", 1);