aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2024-02-12 14:57:13 +0800
committerGitHub <noreply@github.com>2024-02-12 14:57:13 +0800
commit4682f158a062dd8ede37c568c3e456aac83819fc (patch)
tree22d56861c7ae33a9616a0e1bcf51517141368995
parent929e1b7f1c35679424989f5ebfc78f095bb434d9 (diff)
downloadrneovim-4682f158a062dd8ede37c568c3e456aac83819fc.tar.gz
rneovim-4682f158a062dd8ede37c568c3e456aac83819fc.tar.bz2
rneovim-4682f158a062dd8ede37c568c3e456aac83819fc.zip
vim-patch:9.1.0098: CompleteChanged not triggered when new leader added without matches (#27436)
Problem: CompleteChanged not triggered when new leader added causing no matching item in the completion menu Solution: When completion is active but no items matched still trigger CompleteChanged event (glepnir) closes: vim/vim#13982 https://github.com/vim/vim/commit/0d3c0a66a39570cbc52b9536604c39e324b989b3 Fix #15077
-rw-r--r--src/nvim/insexpand.c3
-rw-r--r--test/old/testdir/test_popup.vim6
2 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 2f54250392..9d3b400496 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -1279,6 +1279,9 @@ void ins_compl_show_pum(void)
}
if (compl_match_array == NULL) {
+ if (compl_started && has_event(EVENT_COMPLETECHANGED)) {
+ trigger_complete_changed_event(cur);
+ }
return;
}
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index ca6a4c0728..56c881b958 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -1142,6 +1142,10 @@ func Test_CompleteChanged()
let g:event = copy(v:event)
let g:item = get(v:event, 'completed_item', {})
let g:word = get(g:item, 'word', v:null)
+ let l:line = getline('.')
+ if g:word == v:null && l:line == "bc"
+ let g:word = l:line
+ endif
endfunction
augroup AAAAA_Group
au!
@@ -1161,6 +1165,8 @@ func Test_CompleteChanged()
call assert_equal(v:null, g:word)
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
call assert_equal('foobar', g:word)
+ call feedkeys("S\<C-N>bc", 'tx')
+ call assert_equal("bc", g:word)
func Omni_test(findstart, base)
if a:findstart