patch 9.1.0075: insert completion not correct when adding new leader

Commit: 
https://github.com/vim/vim/commit/cbb46b439888e10f87baaca504eafd191723c44b
Author: glepnir <glephun...@gmail.com>
Date:   Sat Feb 3 18:11:13 2024 +0100

    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 <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index ba66e51cf..d712181bc 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -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);
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index a0a1f745a..879d1fa3e 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -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
 
diff --git a/src/version.c b/src/version.c
index 7dca96a6b..78d8cf50d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    75,
 /**/
     74,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rWJq8-00BZKf-09%40256bit.org.

Raspunde prin e-mail lui