From fdf7a5f13db9b31c13f06e57dc72ca01975f7da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 16 Jun 2017 07:27:01 +0200 Subject: [PATCH] fset: add separate word of each option in completion --- src/plugins/fset/fset-completion.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/plugins/fset/fset-completion.c b/src/plugins/fset/fset-completion.c index e4d4ba7a9..3fe765e5e 100644 --- a/src/plugins/fset/fset-completion.c +++ b/src/plugins/fset/fset-completion.c @@ -38,7 +38,8 @@ fset_completion_option_cb (const void *pointer, void *data, struct t_config_file *ptr_config; struct t_config_section *ptr_section; struct t_config_option *ptr_option; - int config_section_added; + char **words; + int config_section_added, num_words, i; /* make C compiler happy */ (void) pointer; @@ -73,10 +74,18 @@ fset_completion_option_cb (const void *pointer, void *data, 0, WEECHAT_LIST_POS_SORT); config_section_added = 1; } - weechat_hook_completion_list_add ( - completion, + words = weechat_string_split ( weechat_config_option_get_string (ptr_option, "name"), - 0, WEECHAT_LIST_POS_SORT); + "_", 0, 0, &num_words); + if (words) + { + for (i = 0; i < num_words; i++) + { + weechat_hook_completion_list_add ( + completion, words[i], 0, WEECHAT_LIST_POS_SORT); + } + weechat_string_free_split (words); + } ptr_option = weechat_hdata_move (fset_hdata_config_option, ptr_option, 1); }