diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index fd3a0309f7..a6cdc913f7 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -3448,7 +3448,7 @@ static void set_completion(colnr_T startcol, list_T *list) bool compl_no_select = (cur_cot_flags & kOptCotFlagNoselect) != 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(); diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 99fcbdb1b0..485ea9dc1b 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -2995,7 +2995,7 @@ describe('builtin popupmenu', function() occaecat cupidatat non proident, sunt in culpa | qui officia deserunt mollit anim id est | ## grid 3 - {5:-- Keyword Local completion (^N^P) }{6:match 1 of 9} | + {5:-- INSERT --} | ## grid 4 Est eu^ | Lorem ipsum dolor sit amet, consectetur | @@ -3031,7 +3031,7 @@ describe('builtin popupmenu', function() occaecat cupidatat non proident, sunt in culpa | qui officia deserunt mollit anim id est | {2:[No Name] [+] }| - {5:-- Keyword Local completion (^N^P) }{6:match 1 of 9} | + {5:-- INSERT --} | ]]) end diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index d0a789aa06..fd9df78c59 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -6512,4 +6512,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 call complete(3, ['obar', 'obaz']) + call setline(1, ['foobar', 'foobaz']) + + call feedkeys("Gofo\ob\cd\", '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