aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/insexpand.c2
-rw-r--r--test/old/testdir/test_ins_complete.vim2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 9049b1f298..ce82b7f410 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -4243,7 +4243,7 @@ static compl_T *find_comp_when_fuzzy(void)
if ((is_forward && compl_selected_item == compl_match_arraysize - 1)
|| (is_backward && compl_selected_item == 0)) {
return compl_first_match != compl_shown_match
- ? compl_first_match
+ ? (is_forward ? compl_shown_match->cp_next : compl_first_match)
: (compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL);
}
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim
index 187d0acc00..5dd29bcc0a 100644
--- a/test/old/testdir/test_ins_complete.vim
+++ b/test/old/testdir/test_ins_complete.vim
@@ -2866,6 +2866,8 @@ func Test_complete_opt_fuzzy()
call assert_equal('bar', getline('.'))
call feedkeys("Sb\<C-X>\<C-N>\<C-Y>\<ESC>", 'tx')
call assert_equal('blue', getline('.'))
+ call feedkeys("Sb\<C-X>\<C-P>\<C-N>\<C-Y>\<ESC>", 'tx')
+ call assert_equal('b', getline('.'))
" clean up
set omnifunc=