mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
Removed automatic space after filename when using completion
This commit is contained in:
@@ -66,6 +66,7 @@ completion_init (t_completion *completion, void *server, void *channel)
|
||||
completion->position = -1;
|
||||
completion->args = NULL;
|
||||
completion->direction = 0;
|
||||
completion->add_space = 1;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
@@ -297,6 +298,8 @@ completion_list_add_filename (t_completion *completion)
|
||||
int in_user_home = 0;
|
||||
char home[3] = { '~', DIR_SEPARATOR_CHAR, '\0' };
|
||||
|
||||
completion->add_space = 0;
|
||||
|
||||
if ((strncmp (completion->base_word, home, 2) == 0) && getenv("HOME"))
|
||||
in_user_home = 1;
|
||||
else if ((strncmp (completion->base_word, DIR_SEPARATOR, 1) != 0)
|
||||
@@ -1025,6 +1028,7 @@ completion_find_context (t_completion *completion, char *buffer, int size, int p
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
completion->add_space = 1;
|
||||
command = ((buffer[0] == '/') && (buffer[1] != '/')) ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
@@ -1546,6 +1550,7 @@ completion_print_log (t_completion *completion)
|
||||
weechat_log_printf (" position . . . . . . . : %d\n", completion->position);
|
||||
weechat_log_printf (" args . . . . . . . . . : '%s'\n", completion->args);
|
||||
weechat_log_printf (" direction. . . . . . . : %d\n", completion->direction);
|
||||
weechat_log_printf (" add_space. . . . . . . : %d\n", completion->add_space);
|
||||
weechat_log_printf (" completion_list. . . . : 0x%X\n", completion->completion_list);
|
||||
weechat_log_printf (" last_completion. . . . : 0x%X\n", completion->last_completion);
|
||||
weechat_log_printf (" word_found . . . . . . : '%s'\n", completion->word_found);
|
||||
|
||||
@@ -44,6 +44,7 @@ struct t_completion
|
||||
int position; /* position where Tab was pressed */
|
||||
char *args; /* command line args (including base word) */
|
||||
int direction; /* +1 = search next word, -1 = previous word */
|
||||
int add_space; /* add space after completion? */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
|
||||
+10
-7
@@ -628,13 +628,16 @@ gui_input_complete (t_gui_window *window)
|
||||
if ((window->buffer->completion.context == COMPLETION_COMMAND)
|
||||
|| (window->buffer->completion.context == COMPLETION_COMMAND_ARG))
|
||||
{
|
||||
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
if (window->buffer->completion.add_space)
|
||||
{
|
||||
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -66,6 +66,7 @@ completion_init (t_completion *completion, void *server, void *channel)
|
||||
completion->position = -1;
|
||||
completion->args = NULL;
|
||||
completion->direction = 0;
|
||||
completion->add_space = 1;
|
||||
|
||||
completion->completion_list = NULL;
|
||||
completion->last_completion = NULL;
|
||||
@@ -297,6 +298,8 @@ completion_list_add_filename (t_completion *completion)
|
||||
int in_user_home = 0;
|
||||
char home[3] = { '~', DIR_SEPARATOR_CHAR, '\0' };
|
||||
|
||||
completion->add_space = 0;
|
||||
|
||||
if ((strncmp (completion->base_word, home, 2) == 0) && getenv("HOME"))
|
||||
in_user_home = 1;
|
||||
else if ((strncmp (completion->base_word, DIR_SEPARATOR, 1) != 0)
|
||||
@@ -1025,6 +1028,7 @@ completion_find_context (t_completion *completion, char *buffer, int size, int p
|
||||
|
||||
/* look for context */
|
||||
completion_free (completion);
|
||||
completion->add_space = 1;
|
||||
command = ((buffer[0] == '/') && (buffer[1] != '/')) ? 1 : 0;
|
||||
command_arg = 0;
|
||||
i = 0;
|
||||
@@ -1546,6 +1550,7 @@ completion_print_log (t_completion *completion)
|
||||
weechat_log_printf (" position . . . . . . . : %d\n", completion->position);
|
||||
weechat_log_printf (" args . . . . . . . . . : '%s'\n", completion->args);
|
||||
weechat_log_printf (" direction. . . . . . . : %d\n", completion->direction);
|
||||
weechat_log_printf (" add_space. . . . . . . : %d\n", completion->add_space);
|
||||
weechat_log_printf (" completion_list. . . . : 0x%X\n", completion->completion_list);
|
||||
weechat_log_printf (" last_completion. . . . : 0x%X\n", completion->last_completion);
|
||||
weechat_log_printf (" word_found . . . . . . : '%s'\n", completion->word_found);
|
||||
|
||||
@@ -44,6 +44,7 @@ struct t_completion
|
||||
int position; /* position where Tab was pressed */
|
||||
char *args; /* command line args (including base word) */
|
||||
int direction; /* +1 = search next word, -1 = previous word */
|
||||
int add_space; /* add space after completion? */
|
||||
|
||||
/* for command argument completion */
|
||||
t_weelist *completion_list; /* data list for completion */
|
||||
|
||||
@@ -628,13 +628,16 @@ gui_input_complete (t_gui_window *window)
|
||||
if ((window->buffer->completion.context == COMPLETION_COMMAND)
|
||||
|| (window->buffer->completion.context == COMPLETION_COMMAND_ARG))
|
||||
{
|
||||
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
if (window->buffer->completion.add_space)
|
||||
{
|
||||
if (window->buffer->input_buffer[utf8_real_pos (window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_pos)] != ' ')
|
||||
gui_insert_string_input (window, " ",
|
||||
window->buffer->input_buffer_pos);
|
||||
if (window->buffer->completion.position >= 0)
|
||||
window->buffer->completion.position++;
|
||||
window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user