mirror of
https://github.com/vim/vim.git
synced 2025-10-23 08:44:20 -04:00
patch 9.1.1670: completion: autocomplete breaks second completion
Problem: completion: autocomplete breaks second completion (gravndal) Solution: Fix the autocomplete bug (Girish Palya) fixes: #18044 closes: #18068 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
454c7ea484
commit
b4e0bd93a9
10
src/edit.c
10
src/edit.c
@@ -664,9 +664,6 @@ edit(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_ac)
|
|
||||||
ins_compl_set_autocomplete(TRUE);
|
|
||||||
|
|
||||||
// A non-white character that fits in with the current
|
// A non-white character that fits in with the current
|
||||||
// completion: Add to "compl_leader".
|
// completion: Add to "compl_leader".
|
||||||
if (ins_compl_accept_char(c))
|
if (ins_compl_accept_char(c))
|
||||||
@@ -688,9 +685,6 @@ edit(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_ac)
|
|
||||||
ins_compl_set_autocomplete(FALSE);
|
|
||||||
|
|
||||||
// Pressing CTRL-Y selects the current match. When
|
// Pressing CTRL-Y selects the current match. When
|
||||||
// ins_compl_enter_selects() is set the Enter key does the
|
// ins_compl_enter_selects() is set the Enter key does the
|
||||||
// same.
|
// same.
|
||||||
@@ -997,7 +991,7 @@ doESCkey:
|
|||||||
{
|
{
|
||||||
update_screen(UPD_VALID); // Show char deletion immediately
|
update_screen(UPD_VALID); // Show char deletion immediately
|
||||||
out_flush();
|
out_flush();
|
||||||
ins_compl_set_autocomplete(TRUE);
|
ins_compl_enable_autocomplete();
|
||||||
goto docomplete; // Trigger autocompletion
|
goto docomplete; // Trigger autocompletion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1424,7 +1418,7 @@ normalchar:
|
|||||||
{
|
{
|
||||||
update_screen(UPD_VALID); // Show character immediately
|
update_screen(UPD_VALID); // Show character immediately
|
||||||
out_flush();
|
out_flush();
|
||||||
ins_compl_set_autocomplete(TRUE);
|
ins_compl_enable_autocomplete();
|
||||||
goto docomplete;
|
goto docomplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7078,8 +7078,11 @@ ins_complete(int c, int enable_pum)
|
|||||||
int insert_match;
|
int insert_match;
|
||||||
int no_matches_found;
|
int no_matches_found;
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
// Timestamp when match collection starts
|
elapsed_T compl_start_tv = {0}; // Time when match collection starts
|
||||||
elapsed_T compl_start_tv = {0};
|
int disable_ac_delay;
|
||||||
|
|
||||||
|
disable_ac_delay = compl_started && ctrl_x_mode_normal()
|
||||||
|
&& (c == Ctrl_N || c == Ctrl_P || c == Ctrl_R || ins_compl_pum_key(c));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
compl_direction = ins_compl_key2dir(c);
|
compl_direction = ins_compl_key2dir(c);
|
||||||
@@ -7088,16 +7091,13 @@ ins_complete(int c, int enable_pum)
|
|||||||
if (!compl_started)
|
if (!compl_started)
|
||||||
{
|
{
|
||||||
if (ins_compl_start() == FAIL)
|
if (ins_compl_start() == FAIL)
|
||||||
{
|
|
||||||
compl_autocomplete = FALSE;
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (insert_match && stop_arrow() == FAIL)
|
else if (insert_match && stop_arrow() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
if (compl_autocomplete && p_acl > 0)
|
if (compl_autocomplete && p_acl > 0 && !disable_ac_delay)
|
||||||
ELAPSED_INIT(compl_start_tv);
|
ELAPSED_INIT(compl_start_tv);
|
||||||
#endif
|
#endif
|
||||||
compl_curr_win = curwin;
|
compl_curr_win = curwin;
|
||||||
@@ -7152,8 +7152,8 @@ ins_complete(int c, int enable_pum)
|
|||||||
|
|
||||||
// Wait for the autocompletion delay to expire
|
// Wait for the autocompletion delay to expire
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
if (compl_autocomplete && p_acl > 0 && !no_matches_found
|
if (compl_autocomplete && p_acl > 0 && !disable_ac_delay
|
||||||
&& ELAPSED_FUNC(compl_start_tv) < p_acl)
|
&& !no_matches_found && ELAPSED_FUNC(compl_start_tv) < p_acl)
|
||||||
{
|
{
|
||||||
cursor_on();
|
cursor_on();
|
||||||
setcursor();
|
setcursor();
|
||||||
@@ -7178,19 +7178,18 @@ ins_complete(int c, int enable_pum)
|
|||||||
|
|
||||||
compl_was_interrupted = compl_interrupted;
|
compl_was_interrupted = compl_interrupted;
|
||||||
compl_interrupted = FALSE;
|
compl_interrupted = FALSE;
|
||||||
compl_autocomplete = FALSE;
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable/disable autocompletion
|
* Enable autocompletion
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ins_compl_set_autocomplete(int value)
|
ins_compl_enable_autocomplete(void)
|
||||||
{
|
{
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
compl_autocomplete = value;
|
compl_autocomplete = TRUE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,6 +72,6 @@ void ins_compl_delete(void);
|
|||||||
void ins_compl_insert(int move_cursor);
|
void ins_compl_insert(int move_cursor);
|
||||||
void ins_compl_check_keys(int frequency, int in_compl_func);
|
void ins_compl_check_keys(int frequency, int in_compl_func);
|
||||||
int ins_complete(int c, int enable_pum);
|
int ins_complete(int c, int enable_pum);
|
||||||
void ins_compl_set_autocomplete(int val);
|
void ins_compl_enable_autocomplete(void);
|
||||||
void free_insexpand_stuff(void);
|
void free_insexpand_stuff(void);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@@ -5358,7 +5358,7 @@ func Test_autocomplete_timer()
|
|||||||
call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
|
call assert_equal(['abc', 'ab'], b:matches->mapnew('v:val.word'))
|
||||||
call assert_equal(0, b:selected)
|
call assert_equal(0, b:selected)
|
||||||
call assert_equal(1, g:CallCount)
|
call assert_equal(1, g:CallCount)
|
||||||
call assert_equal('ab', getline(4))
|
call assert_equal('abc', getline(4))
|
||||||
set completeopt&
|
set completeopt&
|
||||||
|
|
||||||
" Test 8: {func} completes after space, but not '.'
|
" Test 8: {func} completes after space, but not '.'
|
||||||
|
@@ -724,6 +724,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1670,
|
||||||
/**/
|
/**/
|
||||||
1669,
|
1669,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user