From a243486a4638d223d25dec65751aabf1ba965319 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 2 Jul 2026 03:55:58 +0800 Subject: [PATCH] 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 https://github.com/vim/vim/commit/0b86b97cc9de013483875d0fab14d9040bcbe279 --- src/nvim/insexpand.c | 17 ++--------------- test/functional/editor/completion_spec.lua | 2 -- test/old/testdir/test_ins_complete.vim | 4 +--- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index d79834114a..53c903d8d7 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -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! diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index be6810ff9a..a75cc33697 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -1811,8 +1811,6 @@ describe('completion', function() -- Preinsert command('set completeopt& completeopt+=preinsert') - - -- Show preinserted text right away but display popup later feed('Sau') screen:expect([[ autocomplete | diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index 72e2a11f1a..11431bfcc2 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -6039,7 +6039,7 @@ func Test_autocompletedelay() call term_sendkeys(buf, "\") 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, "\:set completeopt=menuone\") @@ -6442,8 +6442,6 @@ func Test_autocompletedelay_longest_preinsert() " Preinsert call term_sendkeys(buf, "\:set completeopt& completeopt+=preinsert\") - - " Show preinserted text right away but display popup later call term_sendkeys(buf, "\Sau") sleep 100m call VerifyScreenDump(buf, 'Test_autocompletedelay_preinsert_1', {})