vim-patch:9.1.1657: Autocompletion adds delay

Problem:  Autocompletion adds delay
          (gcanat, char101, after v9.1.1638)
Solution: Temporarily disable autocomplation (Girish Palya).

related: vim/vim#17960
fixes: vim/vim#18022
closes: vim/vim#18048

196c376682

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-08-23 20:08:01 +08:00
parent 4019d3050d
commit 6ef996a082
4 changed files with 91 additions and 11 deletions

View File

@@ -581,6 +581,10 @@ 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)) {
@@ -598,6 +602,10 @@ 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
@@ -849,10 +857,11 @@ static int insert_handle_key(InsertState *s)
auto_format(false, true);
if (s->did_backspace && p_ac && !char_avail() && curwin->w_cursor.col > 0) {
s->c = char_before_cursor();
if (ins_compl_setup_autocompl(s->c)) {
if (vim_isprintc(s->c)) {
redraw_later(curwin, UPD_VALID);
update_screen(); // Show char deletion immediately
ui_flush();
ins_compl_set_autocomplete(true);
insert_do_complete(s); // Trigger autocompletion
return 1;
}
@@ -1233,10 +1242,11 @@ normalchar:
// closed fold.
foldOpenCursor();
// Trigger autocompletion
if (p_ac && !char_avail() && ins_compl_setup_autocompl(s->c)) {
if (p_ac && !char_avail() && vim_isprintc(s->c)) {
redraw_later(curwin, UPD_VALID);
update_screen(); // Show character immediately
ui_flush();
ins_compl_set_autocomplete(true);
insert_do_complete(s);
}