]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1772: completion: inconsistent selection of first item with 'autocomplete' v9.1.1772
authorGirish Palya <girishji@gmail.com>
Thu, 18 Sep 2025 19:55:21 +0000 (19:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 18 Sep 2025 19:55:21 +0000 (19:55 +0000)
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 <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/testdir/dumps/Test_fuzzy_autocompletedelay_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_fuzzy_autocompletedelay_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_fuzzy_autocompletedelay_3.dump [new file with mode: 0644]
src/testdir/test_ins_complete.vim
src/version.c

index d98b5c1b0d9d1731055eccee1243bb4293691f1c..d4375f17cec7a2049eef8243662fb6fc97f4efdf 100644 (file)
@@ -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 (file)
index 0000000..ed15dc9
--- /dev/null
@@ -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 (file)
index 0000000..84083f6
--- /dev/null
@@ -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 (file)
index 0000000..b82983f
--- /dev/null
@@ -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| 
index 2bd726b7dff64fbc6cbc81f015a609c47e241ba3..703a1eeecfef7cf41cab21efee521efd482f892e 100644 (file)
@@ -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
index c98d6ccc605251da30ef7a66754787a3ae352a15..4864220d3a6bbd0cf275bed1fc4a696d0f5d49b1 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1772,
 /**/
     1771,
 /**/