summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/core/hook/wee-hook-command.c12
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 1b6d80611..023b180a6 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -25,6 +25,7 @@ New features::
Bug fixes::
+ * core: replace newlines by spaces in argument "completion" of function hook_command (issue #538)
* core: replace char "," by "~" in color codes to separate foreground from background (issue #1264)
* alias: remove default aliases /AME and /AMSG (issue #1355)
* irc: disable server reconnection when the server buffer is closed (issue #236)
diff --git a/src/core/hook/wee-hook-command.c b/src/core/hook/wee-hook-command.c
index 4708a4518..b89d430eb 100644
--- a/src/core/hook/wee-hook-command.c
+++ b/src/core/hook/wee-hook-command.c
@@ -72,13 +72,17 @@ hook_command_build_completion (struct t_hook_command *hook_command)
{
int i, j, k, length, num_items;
struct t_weelist *list;
- char *pos_completion, *pos_double_pipe, *pos_start, *pos_end;
+ char *completion, *pos_completion, *pos_double_pipe, *pos_start, *pos_end;
char **items;
const char *last_space, *ptr_template;
+ completion = string_replace (hook_command->completion, "\n", " ");
+ if (!completion)
+ return;
+
/* split templates using "||" as separator */
hook_command->cplt_num_templates = 1;
- pos_completion = hook_command->completion;
+ pos_completion = completion;
while ((pos_double_pipe = strstr (pos_completion, "||")) != NULL)
{
hook_command->cplt_num_templates++;
@@ -90,7 +94,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
{
hook_command->cplt_templates[i] = NULL;
}
- pos_completion = hook_command->completion;
+ pos_completion = completion;
i = 0;
while (pos_completion)
{
@@ -244,6 +248,8 @@ hook_command_build_completion (struct t_hook_command *hook_command)
}
weelist_free (list);
}
+
+ free (completion);
}
/*