vim-patch:9.1.0684: completion is inserted on Enter with "noselect" (#30111)

Problem:  completion is inserted on Enter with "noselect"
          (Carman Fu)
Solution: check noselect before update compl_shown_match
          (glepnir)

fixes: vim/vim#15526
closes: vim/vim#15530

753794bae8
This commit is contained in:
glepnir 2024-08-31 17:10:05 +08:00 committed by GitHub
parent 53af02adba
commit a6c4487e8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -1244,7 +1244,9 @@ static int ins_compl_build_pum(void)
if (comp->cp_score > max_fuzzy_score) {
did_find_shown_match = true;
max_fuzzy_score = comp->cp_score;
compl_shown_match = comp;
if (!compl_no_select) {
compl_shown_match = comp;
}
}
if (!shown_match_ok && comp == compl_shown_match && !compl_no_select) {

View File

@ -2664,6 +2664,13 @@ func Test_complete_fuzzy_match()
call feedkeys("A\<C-X>\<C-N>\<Esc>0", 'tx!')
call assert_equal('hello help hero h', getline('.'))
" issue #15526
set completeopt=fuzzy,menuone,menu,noselect
call setline(1, ['Text', 'ToText', ''])
call cursor(2, 1)
call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!')
call assert_equal('Tex', getline('.'))
" clean up
set omnifunc=
bw!