patch 9.1.1772: completion: inconsistent selection of first item with 
'autocomplete'

Commit: 
https://github.com/vim/vim/commit/86e8e909f2e8cc1f851b4b62c3060c86c1afae65
Author: Girish Palya <[email protected]>
Date:   Thu Sep 18 19:55:21 2025 +0000

    patch 9.1.1772: completion: inconsistent selection of first item with 
'autocomplete'
    
    Problem:  completion: inconsistent selection of first item with
              'autocomplete' (Tomasz N)
    Solution: Check for 'autocomplete' option in ins_compl_new_leader()
              (Girish Palya).
    
    fixes: #18326
    closes: #18329
    
    Signed-off-by: Girish Palya <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/insexpand.c b/src/insexpand.c
index d98b5c1b0..d4375f17c 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -2517,7 +2517,7 @@ ins_compl_new_leader(void)
                    && compl_first_match)
            {
                compl_shown_match = compl_first_match;
-               if (compl_shows_dir_forward())
+               if (compl_shows_dir_forward() && !compl_autocomplete)
                    compl_shown_match = compl_first_match->cp_next;
            }
        }
diff --git a/src/testdir/dumps/Test_fuzzy_autocompletedelay_1.dump 
b/src/testdir/dumps/Test_fuzzy_autocompletedelay_1.dump
new file mode 100644
index 000000000..ed15dc962
--- /dev/null
+++ b/src/testdir/dumps/Test_fuzzy_autocompletedelay_1.dump
@@ -0,0 +1,10 @@
+|v+0&#ffffff0| @73
+|v|i| @72
+|v|i|m| @71
+|v|i> @72
+|v+0#0000001#ffd7ff255|i| @12| +0#4040ff13#ffffff0@59
+|v+0#0000001#ffd7ff255|i|m| @11| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|4|,|1| @10|T|o|p| 
diff --git a/src/testdir/dumps/Test_fuzzy_autocompletedelay_2.dump 
b/src/testdir/dumps/Test_fuzzy_autocompletedelay_2.dump
new file mode 100644
index 000000000..84083f663
--- /dev/null
+++ b/src/testdir/dumps/Test_fuzzy_autocompletedelay_2.dump
@@ -0,0 +1,10 @@
+|v+0&#ffffff0| @73
+|v|i| @72
+|v|i|m| @71
+|v> @73
+|v+0#0000001#ffd7ff255| @13| +0#4040ff13#ffffff0@59
+|v+0#0000001#ffd7ff255|i| @12| +0#4040ff13#ffffff0@59
+|v+0#0000001#ffd7ff255|i|m| @11| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|4|,|1| @10|A|l@1| 
diff --git a/src/testdir/dumps/Test_fuzzy_autocompletedelay_3.dump 
b/src/testdir/dumps/Test_fuzzy_autocompletedelay_3.dump
new file mode 100644
index 000000000..b82983f94
--- /dev/null
+++ b/src/testdir/dumps/Test_fuzzy_autocompletedelay_3.dump
@@ -0,0 +1,10 @@
+|v+0&#ffffff0| @73
+|v|i| @72
+|v|i|m| @71
+|v|i> @72
+|v+0#0000001#ffd7ff255|i| @12| +0#4040ff13#ffffff0@59
+|v+0#0000001#ffd7ff255|i|m| @11| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|4|,|3| @10|A|l@1| 
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index 2bd726b7d..703a1eeec 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -5729,4 +5729,27 @@ func Test_autocomplete_completeopt_preinsert()
   call test_override("char_avail", 0)
 endfunc
 
+" Issue #18326
+func Test_fuzzy_select_item_when_acl()
+  CheckScreendump
+  let lines =<< trim [SCRIPT]
+    call setline(1, ["v", "vi", "vim"])
+    set autocomplete completeopt=menuone,noinsert,fuzzy autocompletedelay=300
+  [SCRIPT]
+  call writefile(lines, 'XTest_autocomplete_delay', 'D')
+  let buf = RunVimInTerminal('-S XTest_autocomplete_delay', {'rows': 10})
+
+  call term_sendkeys(buf, "Govi")
+  call VerifyScreenDump(buf, 'Test_fuzzy_autocompletedelay_1', {})
+
+  call term_sendkeys(buf, "\<Esc>Sv")
+  call VerifyScreenDump(buf, 'Test_fuzzy_autocompletedelay_2', {})
+  sleep 500m
+  call term_sendkeys(buf, "i")
+  call VerifyScreenDump(buf, 'Test_fuzzy_autocompletedelay_3', {})
+
+  call term_sendkeys(buf, "\<esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/version.c b/src/version.c
index c98d6ccc6..4864220d3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1772,
 /**/
     1771,
 /**/

-- 
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uzKnW-00EmtI-P4%40256bit.org.

Raspunde prin e-mail lui