vim-patch:9.1.1670: completion: autocomplete breaks second completion

Problem:  completion: autocomplete breaks second completion
          (gravndal)
Solution: Fix the autocomplete bug (Girish Palya)

fixes: vim/vim#18044
closes: vim/vim#18068

b4e0bd93a9

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-08-23 20:20:43 +08:00
parent 1c0465bec6
commit 963ead29d9
3 changed files with 13 additions and 20 deletions

View File

@@ -581,10 +581,6 @@ static int insert_execute(VimState *state, int key)
return 1; // continue
}
if (p_ac) {
ins_compl_set_autocomplete(true);
}
// A non-white character that fits in with the current
// completion: Add to "compl_leader".
if (ins_compl_accept_char(s->c)) {
@@ -602,10 +598,6 @@ static int insert_execute(VimState *state, int key)
return 1; // continue
}
if (p_ac) {
ins_compl_set_autocomplete(false);
}
// Pressing CTRL-Y selects the current match. When
// compl_enter_selects is set the Enter key does the same.
if ((s->c == Ctrl_Y
@@ -861,7 +853,7 @@ static int insert_handle_key(InsertState *s)
redraw_later(curwin, UPD_VALID);
update_screen(); // Show char deletion immediately
ui_flush();
ins_compl_set_autocomplete(true);
ins_compl_enable_autocomplete();
insert_do_complete(s); // Trigger autocompletion
return 1;
}
@@ -1246,7 +1238,7 @@ normalchar:
redraw_later(curwin, UPD_VALID);
update_screen(); // Show character immediately
ui_flush();
ins_compl_set_autocomplete(true);
ins_compl_enable_autocomplete();
insert_do_complete(s);
}