aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/insexpand.c4
-rw-r--r--test/old/testdir/test_ins_complete.vim16
-rw-r--r--test/old/testdir/test_popup.vim2
3 files changed, 14 insertions, 8 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index b557b9802e..8b1c09b32f 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -1198,6 +1198,10 @@ static int ins_compl_build_pum(void)
// match after it, don't highlight anything.
bool shown_match_ok = match_at_original_text(compl_shown_match);
+ if (strequal(compl_leader, compl_orig_text) && !shown_match_ok) {
+ compl_shown_match = compl_no_select ? compl_first_match : compl_first_match->cp_next;
+ }
+
compl_T *shown_compl = NULL;
bool did_find_shown_match = false;
int cur = -1;
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim
index 3f67a06999..45db2a7364 100644
--- a/test/old/testdir/test_ins_complete.vim
+++ b/test/old/testdir/test_ins_complete.vim
@@ -700,14 +700,14 @@ func Test_pum_with_preview_win()
CheckScreendump
let lines =<< trim END
- funct Omni_test(findstart, base)
- if a:findstart
- return col(".") - 1
- endif
- return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
- endfunc
- set omnifunc=Omni_test
- set completeopt+=longest
+ funct Omni_test(findstart, base)
+ if a:findstart
+ return col(".") - 1
+ endif
+ return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}]
+ endfunc
+ set omnifunc=Omni_test
+ set completeopt+=longest
END
call writefile(lines, 'Xpreviewscript')
diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim
index 56c881b958..5ae2ed5ed5 100644
--- a/test/old/testdir/test_popup.vim
+++ b/test/old/testdir/test_popup.vim
@@ -1178,6 +1178,8 @@ func Test_CompleteChanged()
set completeopt=menu,menuone
call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f", 'tx')
call assert_equal('five', g:word)
+ call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f\<BS>", 'tx')
+ call assert_equal('one', g:word)
autocmd! AAAAA_Group
set complete& completeopt&