mirror of
https://github.com/weechat/weechat.git
synced 2026-07-02 07:46:38 +02:00
core: add new option weechat.completion.base_word_until_cursor: allow completion in middle of words (enabled by default) (task #9771)
This commit is contained in:
@@ -202,6 +202,7 @@ struct t_config_option *config_color_nicklist_offline;
|
||||
|
||||
/* config, completion section */
|
||||
|
||||
struct t_config_option *config_completion_base_word_until_cursor;
|
||||
struct t_config_option *config_completion_default_template;
|
||||
struct t_config_option *config_completion_nick_add_space;
|
||||
struct t_config_option *config_completion_nick_completer;
|
||||
@@ -2427,6 +2428,12 @@ config_weechat_init_options ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
config_completion_base_word_until_cursor = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"base_word_until_cursor", "boolean",
|
||||
N_("if enabled, the base word to complete ends at char before cursor; "
|
||||
"otherwise the base word ends at first space after cursor"),
|
||||
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_default_template = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"default_template", "string",
|
||||
|
||||
@@ -222,6 +222,7 @@ extern struct t_config_option *config_color_nicklist_group;
|
||||
extern struct t_config_option *config_color_nicklist_away;
|
||||
extern struct t_config_option *config_color_nicklist_offline;
|
||||
|
||||
extern struct t_config_option *config_completion_base_word_until_cursor;
|
||||
extern struct t_config_option *config_completion_default_template;
|
||||
extern struct t_config_option *config_completion_nick_add_space;
|
||||
extern struct t_config_option *config_completion_nick_completer;
|
||||
|
||||
@@ -686,12 +686,21 @@ gui_completion_find_context (struct t_gui_completion *completion,
|
||||
}
|
||||
pos_start = i + 1;
|
||||
}
|
||||
i = pos;
|
||||
while ((i < size) && (data[i] != ' '))
|
||||
if (CONFIG_BOOLEAN (config_completion_base_word_until_cursor))
|
||||
{
|
||||
i++;
|
||||
/* base word stops at cursor */
|
||||
pos_end = pos - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* base word stops after first space found (on or after cursor) */
|
||||
i = pos;
|
||||
while ((i < size) && (data[i] != ' '))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
pos_end = i - 1;
|
||||
}
|
||||
pos_end = i - 1;
|
||||
|
||||
if (completion->context == GUI_COMPLETION_COMMAND)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user