mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 21:36:37 +02:00
Fix bug with partial completions
Option "weechat.completion.partial_completion_nick" has been renamed to "weechat.completion.partial_completion_other".
This commit is contained in:
@@ -149,9 +149,9 @@ struct t_config_option *config_completion_nick_completor;
|
||||
struct t_config_option *config_completion_nick_first_only;
|
||||
struct t_config_option *config_completion_nick_ignore_chars;
|
||||
struct t_config_option *config_completion_partial_completion_alert;
|
||||
struct t_config_option *config_completion_partial_completion_nick;
|
||||
struct t_config_option *config_completion_partial_completion_command;
|
||||
struct t_config_option *config_completion_partial_completion_command_arg;
|
||||
struct t_config_option *config_completion_partial_completion_other;
|
||||
struct t_config_option *config_completion_partial_completion_count;
|
||||
|
||||
/* config, history section */
|
||||
@@ -1625,12 +1625,6 @@ config_weechat_init_options ()
|
||||
"partial_completion_alert", "boolean",
|
||||
N_("alert user when a partial completion occurs"),
|
||||
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_nick = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"partial_completion_nick", "boolean",
|
||||
N_("partially complete nicks (stop when many nicks found begin with "
|
||||
"same letters)"),
|
||||
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_command = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"partial_completion_command", "boolean",
|
||||
@@ -1643,6 +1637,12 @@ config_weechat_init_options ()
|
||||
N_("partially complete command arguments (stop when many arguments "
|
||||
"found begin with same prefix)"),
|
||||
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_other = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"partial_completion_other", "boolean",
|
||||
N_("partially complete outside commands (stop when many words found "
|
||||
"begin with same letters)"),
|
||||
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_count = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"partial_completion_count", "boolean",
|
||||
|
||||
@@ -151,9 +151,9 @@ extern struct t_config_option *config_completion_nick_completor;
|
||||
extern struct t_config_option *config_completion_nick_first_only;
|
||||
extern struct t_config_option *config_completion_nick_ignore_chars;
|
||||
extern struct t_config_option *config_completion_partial_completion_alert;
|
||||
extern struct t_config_option *config_completion_partial_completion_nick;
|
||||
extern struct t_config_option *config_completion_partial_completion_command;
|
||||
extern struct t_config_option *config_completion_partial_completion_command_arg;
|
||||
extern struct t_config_option *config_completion_partial_completion_other;
|
||||
extern struct t_config_option *config_completion_partial_completion_count;
|
||||
|
||||
extern struct t_config_option *config_history_max_lines;
|
||||
|
||||
+15
-43
@@ -65,7 +65,6 @@ gui_completion_init (struct t_gui_completion *completion,
|
||||
completion->context = GUI_COMPLETION_NULL;
|
||||
completion->base_command = NULL;
|
||||
completion->base_command_arg = 0;
|
||||
completion->arg_is_nick = 0;
|
||||
completion->base_word = NULL;
|
||||
completion->base_word_pos = 0;
|
||||
completion->position = -1;
|
||||
@@ -605,8 +604,6 @@ gui_completion_list_add_nicks (struct t_gui_completion *completion)
|
||||
&ptr_group, &ptr_nick);
|
||||
}
|
||||
}
|
||||
|
||||
completion->arg_is_nick = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1430,8 +1427,7 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
|
||||
*/
|
||||
|
||||
void
|
||||
gui_completion_complete (struct t_gui_completion *completion,
|
||||
int nick_completion)
|
||||
gui_completion_complete (struct t_gui_completion *completion)
|
||||
{
|
||||
int length, word_found_seen, other_completion, partial_completion;
|
||||
int common_prefix_size, item_is_nick;
|
||||
@@ -1442,26 +1438,21 @@ gui_completion_complete (struct t_gui_completion *completion,
|
||||
other_completion = 0;
|
||||
|
||||
partial_completion = completion->force_partial_completion;
|
||||
|
||||
|
||||
if (!partial_completion)
|
||||
{
|
||||
if (nick_completion)
|
||||
if (completion->context == GUI_COMPLETION_COMMAND)
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_nick);
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command);
|
||||
}
|
||||
else if (completion->context == GUI_COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command_arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (completion->context == GUI_COMPLETION_COMMAND)
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command);
|
||||
}
|
||||
else
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command_arg);
|
||||
}
|
||||
}
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_other);
|
||||
}
|
||||
|
||||
|
||||
common_prefix_size = 0;
|
||||
if (partial_completion
|
||||
&& completion->completion_list && completion->completion_list->items)
|
||||
@@ -1585,7 +1576,7 @@ gui_completion_complete (struct t_gui_completion *completion,
|
||||
free (completion->word_found);
|
||||
completion->word_found = NULL;
|
||||
completion->word_found_is_nick = 0;
|
||||
gui_completion_complete (completion, nick_completion);
|
||||
gui_completion_complete (completion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1614,22 +1605,7 @@ gui_completion_command (struct t_gui_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
gui_completion_complete (completion, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_nick: complete a nick
|
||||
*/
|
||||
|
||||
void
|
||||
gui_completion_nick (struct t_gui_completion *completion)
|
||||
{
|
||||
if (!completion->completion_list->items)
|
||||
gui_completion_list_add_nicks (completion);
|
||||
|
||||
completion->context = GUI_COMPLETION_NICK;
|
||||
|
||||
gui_completion_complete (completion, 1);
|
||||
gui_completion_complete (completion);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1645,7 +1621,7 @@ gui_completion_auto (struct t_gui_completion *completion)
|
||||
{
|
||||
if (!completion->completion_list->items)
|
||||
gui_completion_list_add_filename (completion);
|
||||
gui_completion_complete (completion, 0);
|
||||
gui_completion_complete (completion);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1656,7 +1632,7 @@ gui_completion_auto (struct t_gui_completion *completion)
|
||||
CONFIG_STRING(config_completion_default_template),
|
||||
NULL);
|
||||
}
|
||||
gui_completion_complete (completion, 0);
|
||||
gui_completion_complete (completion);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1690,15 +1666,12 @@ gui_completion_search (struct t_gui_completion *completion, int direction,
|
||||
case GUI_COMPLETION_NULL:
|
||||
/* should never be executed */
|
||||
return;
|
||||
case GUI_COMPLETION_NICK:
|
||||
gui_completion_nick (completion);
|
||||
break;
|
||||
case GUI_COMPLETION_COMMAND:
|
||||
gui_completion_command (completion);
|
||||
break;
|
||||
case GUI_COMPLETION_COMMAND_ARG:
|
||||
if (completion->completion_list->items)
|
||||
gui_completion_complete (completion, completion->arg_is_nick);
|
||||
gui_completion_complete (completion);
|
||||
else
|
||||
{
|
||||
completion->context = GUI_COMPLETION_AUTO;
|
||||
@@ -1742,7 +1715,6 @@ gui_completion_print_log (struct t_gui_completion *completion)
|
||||
log_printf (" context . . . . . . . . : %d", completion->context);
|
||||
log_printf (" base_command. . . . . . : '%s'", completion->base_command);
|
||||
log_printf (" base_command_arg. . . . : %d", completion->base_command_arg);
|
||||
log_printf (" arg_is_nick . . . . . . : %d", completion->arg_is_nick);
|
||||
log_printf (" base_word . . . . . . . : '%s'", completion->base_word);
|
||||
log_printf (" base_word_pos . . . . . : %d", completion->base_word_pos);
|
||||
log_printf (" position. . . . . . . . : %d", completion->position);
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
#define __WEECHAT_GUI_COMPLETION_H 1
|
||||
|
||||
#define GUI_COMPLETION_NULL 0
|
||||
#define GUI_COMPLETION_NICK 1
|
||||
#define GUI_COMPLETION_COMMAND 2
|
||||
#define GUI_COMPLETION_COMMAND_ARG 3
|
||||
#define GUI_COMPLETION_AUTO 4
|
||||
#define GUI_COMPLETION_COMMAND 1
|
||||
#define GUI_COMPLETION_COMMAND_ARG 2
|
||||
#define GUI_COMPLETION_AUTO 3
|
||||
|
||||
struct t_gui_completion
|
||||
{
|
||||
@@ -33,7 +32,6 @@ struct t_gui_completion
|
||||
int context; /* context: null, nick, command, cmd arg */
|
||||
char *base_command; /* cmd with arg to complete (can be NULL) */
|
||||
int base_command_arg; /* # arg to complete (if context=cmd arg) */
|
||||
int arg_is_nick; /* argument is nick */
|
||||
char *base_word; /* word to complete (when Tab was pressed) */
|
||||
int base_word_pos; /* beggining of base word */
|
||||
int position; /* position where Tab was pressed */
|
||||
|
||||
Reference in New Issue
Block a user