]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0075: insert completion not correct when adding new leader v9.1.0075
authorglepnir <glephunter@gmail.com>
Sat, 3 Feb 2024 17:11:13 +0000 (18:11 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 3 Feb 2024 17:11:13 +0000 (18:11 +0100)
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 <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/test_popup.vim
src/version.c

index ba66e51cfb7c4adcb41dd8f7b28aad2b174afd28..d712181bcd478724528cdebede086dc69ba7b8f7 100644 (file)
@@ -1363,6 +1363,10 @@ ins_compl_show_pum(void)
     pum_display(compl_match_array, compl_match_arraysize, cur);
     curwin->w_cursor.col = col;
 
+    // After adding leader, set the current match to shown match.
+    if (compl_started && compl_curr_match != compl_shown_match)
+       compl_curr_match = compl_shown_match;
+
 #ifdef FEAT_EVAL
     if (has_completechanged())
        trigger_complete_changed_event(cur);
index a0a1f745a763ab4be67137c185805eb9fc41ce1e..879d1fa3e569de54c506f03e3596f644002875fe 100644 (file)
@@ -1159,9 +1159,21 @@ func Test_CompleteChanged()
   call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
   call assert_equal('foobar', g:word)
 
+  func Omni_test(findstart, base)
+    if a:findstart
+      return col(".")
+    endif
+    return [#{word: "one"}, #{word: "two"}, #{word: "five"}]
+  endfunc
+  set omnifunc=Omni_test
+  set completeopt=menu,menuone
+  call feedkeys("i\<C-X>\<C-O>\<BS>\<BS>\<BS>f", 'tx')
+  call assert_equal('five', g:word)
+
   autocmd! AAAAA_Group
   set complete& completeopt&
   delfunc! OnPumChange
+  delfunc! Omni_test
   bw!
 endfunc
 
index 7dca96a6b0441d7d9355c5559b5b0decda75302d..78d8cf50d0869e898d99f870bcbd9700f634141f 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    75,
 /**/
     74,
 /**/