]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1272: completion: in keyword completion Ctrl_P cannot go back after Ctrl_N v9.1.1272
authorglepnir <glephunter@gmail.com>
Thu, 3 Apr 2025 19:17:06 +0000 (21:17 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 3 Apr 2025 19:17:06 +0000 (21:17 +0200)
Problem:  completion: in keyword completion Ctrl_P cannot go back after
          Ctrl_N
Solution: in find_compl_when_fuzzy() always return first match of array, after Ctrl_P
          use compl_shown_match->cp_next instead of compl_first_match.
          (glepnir)

closes: #17043

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index de3d5198235f0be0adfec51707945bb300f0f433..9df04453929840d310e4e44f8829c71b5afc701c 100644 (file)
@@ -4831,7 +4831,8 @@ 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 :
+       return compl_first_match != compl_shown_match ?
+           (is_forward ? compl_shown_match->cp_next : compl_first_match) :
            (compl_first_match->cp_prev ? compl_first_match->cp_prev : NULL);
 
     if (is_forward)
index f60aba8d7a2b56599d325989b8d9e1040fb74096..bc971b5da85385adac5ea2f6395df4749764f45b 100644 (file)
@@ -2834,6 +2834,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=
index f77ff4794a576a45f3cb7ebbc9ec7ef791c03bc4..28c02486651171493ee6db685d2b95e56e4bdc9b 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1272,
 /**/
     1271,
 /**/