]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0682: Wrong dot-repeat when calling complete() while filtering completion v9.2.0682
authorzeertzjq <zeertzjq@outlook.com>
Sun, 21 Jun 2026 12:52:36 +0000 (12:52 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 21 Jun 2026 12:52:36 +0000 (12:52 +0000)
Problem:  Wrong dot-repeat when calling complete() while filtering
          Ctrl-N completion.
Solution: Also check compl_started for whether completion is active.
          (zeertzjq)

related: neovim/neovim#40346
closes:  #20595

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index 019fd252ac8ee7b86325a0a15c17591a8387cdff..5adad45309a8ce6c47e7652b54501f2b62bd54f2 100644 (file)
@@ -3878,7 +3878,7 @@ set_completion(colnr_T startcol, list_T *list)
     int compl_no_select = (cur_cot_flags & COT_NOSELECT) != 0;
 
     // If already doing completions stop it.
-    if (ctrl_x_mode_not_default())
+    if (compl_started || ctrl_x_mode_not_default())
        ins_compl_prep(' ');
     ins_compl_clear();
     ins_compl_free();
index aafc4a84d3b3a25326619df061eaadda8f503d7f..93ca66f5a9ad1a1d3a442c2415a0cff832dabd06 100644 (file)
@@ -6401,4 +6401,20 @@ func Test_smartcase_longest()
   delfunc TestInner
 endfunc
 
+" Check that calling complete() while filtering Ctrl-N completion doesn't
+" break dot-repeat.
+func Test_call_complete_while_filtering()
+  new
+  setlocal complete=. completeopt=menuone,noselect
+  inoremap <buffer> <F2> <Cmd>call complete(3, ['obar', 'obaz'])<CR>
+  call setline(1, ['foobar', 'foobaz'])
+
+  call feedkeys("Gofo\<C-N>ob\<F2>cd\<Esc>", 'tx')
+  call assert_equal(['foobar', 'foobaz', 'foobcd'], getline(1, '$'))
+  normal! .
+  call assert_equal(['foobar', 'foobaz', 'foobcd', 'foobcd'], getline(1, '$'))
+
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable
index edf47e86b75e7660c8fa749c70c075e420578780..4275dec4b87dad5ef137480d52c0dc7e0763cd10 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    682,
 /**/
     681,
 /**/