Skip to content

Commit 753794b

Browse files
glepnirchrisbra
authored andcommitted
patch 9.1.0684: completion is inserted on Enter with "noselect"
Problem: completion is inserted on Enter with "noselect" (Carman Fu) Solution: check noselect before update compl_shown_match (glepnir) fixes: #15526 closes: #15530 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 12333ba commit 753794b

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/insexpand.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,8 @@ ins_compl_build_pum(void)
13111311
{
13121312
did_find_shown_match = TRUE;
13131313
max_fuzzy_score = compl->cp_score;
1314-
compl_shown_match = compl;
1314+
if (!compl_no_select)
1315+
compl_shown_match = compl;
13151316
}
13161317

13171318
if (!shown_match_ok && compl == compl_shown_match && !compl_no_select)

src/testdir/test_ins_complete.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,13 @@ func Test_complete_fuzzy_match()
26542654
call feedkeys("Su\<C-X>\<C-L>\<C-P>\<Esc>0", 'tx!')
26552655
call assert_equal('no one can save me but you', getline('.'))
26562656

2657+
" issue #15526
2658+
set completeopt=fuzzy,menuone,menu,noselect
2659+
call setline(1, ['Text', 'ToText', ''])
2660+
call cursor(2, 1)
2661+
call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!')
2662+
call assert_equal('Tex', getline('.'))
2663+
26572664
" clean up
26582665
set omnifunc=
26592666
bw!

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
684,
707709
/**/
708710
683,
709711
/**/

0 commit comments

Comments
 (0)