Skip to content

Commit cbb46b4

Browse files
glepnirchrisbra
authored andcommitted
patch 9.1.0075: insert completion not correct when adding new leader
Problem: insert completion not correct when adding new leader Solution: Reset compl_curr_match to compl_shown_match (glepnir) closes: #13957 Co-authored-by: glepnir <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent eac3fdc commit cbb46b4

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/insexpand.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,10 @@ ins_compl_show_pum(void)
13631363
pum_display(compl_match_array, compl_match_arraysize, cur);
13641364
curwin->w_cursor.col = col;
13651365

1366+
// After adding leader, set the current match to shown match.
1367+
if (compl_started && compl_curr_match != compl_shown_match)
1368+
compl_curr_match = compl_shown_match;
1369+
13661370
#ifdef FEAT_EVAL
13671371
if (has_completechanged())
13681372
trigger_complete_changed_event(cur);

src/testdir/test_popup.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,9 +1159,21 @@ func Test_CompleteChanged()
11591159
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
11601160
call assert_equal('foobar', g:word)
11611161

1162+
func Omni_test(findstart, base)
1163+
if a:findstart
1164+
return col(".")
1165+
endif
1166+
return [#{word: "one"}, #{word: "two"}, #{word: "five"}]
1167+
endfunc
1168+
set omnifunc=Omni_test
1169+
set completeopt=menu,menuone
1170+
call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f", 'tx')
1171+
call assert_equal('five', g:word)
1172+
11621173
autocmd! AAAAA_Group
11631174
set complete& completeopt&
11641175
delfunc! OnPumChange
1176+
delfunc! Omni_test
11651177
bw!
11661178
endfunc
11671179

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+
75,
707709
/**/
708710
74,
709711
/**/

0 commit comments

Comments
 (0)