vim-patch:9.2.0759: Some code for 'autocompletedelay' is no longer needed

Problem:  Some code for 'autocompletedelay' is no longer needed now that
          'autocompletedelay' doesn't block redraw (after 9.2.0739).
Solution: Remove unnecessary code. Also remove a duplicate screendump
          and an outdated comment in test (zeertzjq)

closes: vim/vim#20686

0b86b97cc9
This commit is contained in:
zeertzjq
2026-07-02 03:55:58 +08:00
parent cef0dcd54e
commit a243486a46
3 changed files with 3 additions and 20 deletions

View File

@@ -2338,13 +2338,6 @@ static void ins_compl_new_leader(void)
ins_compl_insert_bytes(compl_leader.data + get_compl_len(), -1);
compl_used_match = false;
if (p_acl > 0) {
pum_undisplay(true);
redraw_later(curwin, UPD_VALID);
update_screen(); // Show char (deletion) immediately
ui_flush();
}
int save_w_wrow = curwin->w_wrow;
int save_w_leftcol = curwin->w_leftcol;
if (compl_started) {
@@ -5422,7 +5415,6 @@ static int ins_compl_next(bool allow_get_expansion, int count, bool insert_match
bool compl_no_insert = (cur_cot_flags & kOptCotFlagNoinsert) != 0
|| (compl_autocomplete && !ins_compl_has_preinsert());
bool compl_preinsert = ins_compl_has_preinsert();
bool has_autocomplete_delay = (compl_autocomplete && p_acl > 0);
// When user complete function return -1 for findstart which is next
// time of 'always', compl_shown_match become NULL.
@@ -5469,9 +5461,6 @@ static int ins_compl_next(bool allow_get_expansion, int count, bool insert_match
// Insert the text of the new completion, or the compl_leader.
if (!started && ins_compl_preinsert_longest()) {
ins_compl_insert(true, true);
if (has_autocomplete_delay) {
update_screen(); // Show the inserted text right away
}
} else if (compl_no_insert && !started && !compl_preinsert) {
ins_compl_insert_bytes(compl_orig_text.data + get_compl_len(), -1);
compl_used_match = false;
@@ -5496,10 +5485,8 @@ static int ins_compl_next(bool allow_get_expansion, int count, bool insert_match
// redraw to show the user what was inserted
update_screen(); // TODO(bfredl): no!
if (!has_autocomplete_delay) {
// display the updated popup menu
ins_compl_show_pum();
}
// display the updated popup menu
ins_compl_show_pum();
// Delete old text to be replaced, since we're still searching and
// don't want to match ourselves!

View File

@@ -1811,8 +1811,6 @@ describe('completion', function()
-- Preinsert
command('set completeopt& completeopt+=preinsert')
-- Show preinserted text right away but display popup later
feed('<Esc>Sau')
screen:expect([[
autocomplete |

View File

@@ -6039,7 +6039,7 @@ func Test_autocompletedelay()
call term_sendkeys(buf, "\<BS>")
call VerifyScreenDump(buf, 'Test_autocompletedelay_5', {})
sleep 500m
call VerifyScreenDump(buf, 'Test_autocompletedelay_6', {})
call VerifyScreenDump(buf, 'Test_autocompletedelay_5', {})
" During delay wait, user can open menu using CTRL_N completion
call term_sendkeys(buf, "\<Esc>:set completeopt=menuone\<CR>")
@@ -6442,8 +6442,6 @@ func Test_autocompletedelay_longest_preinsert()
" Preinsert
call term_sendkeys(buf, "\<Esc>:set completeopt& completeopt+=preinsert\<CR>")
" Show preinserted text right away but display popup later
call term_sendkeys(buf, "\<Esc>Sau")
sleep 100m
call VerifyScreenDump(buf, 'Test_autocompletedelay_preinsert_1', {})