core: replace newlines by spaces in argument "completion" of function hook_command (closes #538)
This commit is contained in:
parent
60c61c3962
commit
fe90a5ed4e
@ -25,6 +25,7 @@ New features::
|
|||||||
|
|
||||||
Bug fixes::
|
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)
|
* core: replace char "," by "~" in color codes to separate foreground from background (issue #1264)
|
||||||
* alias: remove default aliases /AME and /AMSG (issue #1355)
|
* alias: remove default aliases /AME and /AMSG (issue #1355)
|
||||||
* irc: disable server reconnection when the server buffer is closed (issue #236)
|
* irc: disable server reconnection when the server buffer is closed (issue #236)
|
||||||
|
@ -72,13 +72,17 @@ hook_command_build_completion (struct t_hook_command *hook_command)
|
|||||||
{
|
{
|
||||||
int i, j, k, length, num_items;
|
int i, j, k, length, num_items;
|
||||||
struct t_weelist *list;
|
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;
|
char **items;
|
||||||
const char *last_space, *ptr_template;
|
const char *last_space, *ptr_template;
|
||||||
|
|
||||||
|
completion = string_replace (hook_command->completion, "\n", " ");
|
||||||
|
if (!completion)
|
||||||
|
return;
|
||||||
|
|
||||||
/* split templates using "||" as separator */
|
/* split templates using "||" as separator */
|
||||||
hook_command->cplt_num_templates = 1;
|
hook_command->cplt_num_templates = 1;
|
||||||
pos_completion = hook_command->completion;
|
pos_completion = completion;
|
||||||
while ((pos_double_pipe = strstr (pos_completion, "||")) != NULL)
|
while ((pos_double_pipe = strstr (pos_completion, "||")) != NULL)
|
||||||
{
|
{
|
||||||
hook_command->cplt_num_templates++;
|
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;
|
hook_command->cplt_templates[i] = NULL;
|
||||||
}
|
}
|
||||||
pos_completion = hook_command->completion;
|
pos_completion = completion;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (pos_completion)
|
while (pos_completion)
|
||||||
{
|
{
|
||||||
@ -244,6 +248,8 @@ hook_command_build_completion (struct t_hook_command *hook_command)
|
|||||||
}
|
}
|
||||||
weelist_free (list);
|
weelist_free (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free (completion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user