patch 9.2.0749: 'autocompletedelay' interferes with i_CTRL-K
Commit:
https://github.com/vim/vim/commit/0d292e20676cb399fa6bee8300d7ae3bebe97a8f
Author: zeertzjq <
zeer...@outlook.com>
Date: Sun Jun 28 19:30:58 2026 +0000
patch 9.2.0749: 'autocompletedelay' interferes with i_CTRL-K
Problem: 'autocompletedelay' interferes with i_CTRL-K (after 9.2.0739).
Solution: Clear the pending autocompltion from the previous key when a
new key is typed.
closes: #20666
Signed-off-by: zeertzjq <
zeer...@outlook.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/edit.c b/src/edit.c
index 93910de6b..bc8ce4128 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -677,6 +677,9 @@ edit(
// Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V.
did_cursorhold = TRUE;
+ if (c != K_CURSORHOLD && c != K_COMPLETE_DELAY)
+ // Don't want delayed autocompletion from the previous key either.
+ ins_compl_clear_autocomplete_delay();
#ifdef FEAT_RIGHTLEFT
if (p_hkmap && KeyTyped)
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index b178ad272..cdcdb217e 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -6000,6 +6000,27 @@ func Test_autocompletedelay_ctrl_g_U()
call Run_test_autocompletedelay_ctrl_g_U(150, 500)
endfunc
+func Run_test_autocompletedelay_ctrl_k(delay1, delay2)
+ new
+ call setline(1, 'foo bar baz')
+ set autocomplete autocompletedelay=200
+
+ call timer_start(a:delay1, { -> feedkeys("\<C-K>", 't') })
+ call timer_start(a:delay2, { -> feedkeys(".,\<Esc>", 't') })
+ call feedkeys('ob', 'tx!')
+ call assert_equal(['foo bar baz', 'b…'], getline(1, '$'))
+
+ set autocomplete& autocompletedelay&
+ bwipe!
+endfunc
+
+func Test_autocompletedelay_ctrl_k()
+ " Ctrl-K typed after 'autocompletedelay' expires
+ call Run_test_autocompletedelay_ctrl_k(250, 500)
+ " Ctrl-K typed before 'autocompletedelay' expires
+ call Run_test_autocompletedelay_ctrl_k(150, 500)
+endfunc
+
" Preinsert longest prefix when autocomplete
func Test_autocomplete_longest()
func GetLine()
diff --git a/src/version.c b/src/version.c
index 784016772..a42f2bd83 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 749,
/**/
748,
/**/