mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:9.1.0075: insert completion not correct when adding new leader (#27332)
Problem: insert completion not correct when adding new leader
Solution: Reset compl_curr_match to compl_shown_match
(glepnir)
closes: vim/vim#13957
cbb46b4398
This commit is contained in:
@@ -1294,6 +1294,11 @@ void ins_compl_show_pum(void)
|
||||
pum_display(compl_match_array, compl_match_arraysize, cur, array_changed, 0);
|
||||
curwin->w_cursor.col = col;
|
||||
|
||||
// After adding leader, set the current match to shown match.
|
||||
if (compl_started && compl_curr_match != compl_shown_match) {
|
||||
compl_curr_match = compl_shown_match;
|
||||
}
|
||||
|
||||
if (has_event(EVENT_COMPLETECHANGED)) {
|
||||
trigger_complete_changed_event(cur);
|
||||
}
|
||||
|
@@ -1162,9 +1162,21 @@ func Test_CompleteChanged()
|
||||
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
|
||||
call assert_equal('foobar', g:word)
|
||||
|
||||
func Omni_test(findstart, base)
|
||||
if a:findstart
|
||||
return col(".")
|
||||
endif
|
||||
return [#{word: "one"}, #{word: "two"}, #{word: "five"}]
|
||||
endfunc
|
||||
set omnifunc=Omni_test
|
||||
set completeopt=menu,menuone
|
||||
call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f", 'tx')
|
||||
call assert_equal('five', g:word)
|
||||
|
||||
autocmd! AAAAA_Group
|
||||
set complete& completeopt&
|
||||
delfunc! OnPumChange
|
||||
delfunc! Omni_test
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
|
Reference in New Issue
Block a user