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 <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-18 19:55:21 +00:00
committed by Christian Brabandt
parent ee9a2f0512
commit 86e8e909f2
6 changed files with 56 additions and 1 deletions

View 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;
}
}

View File

@ -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|

View File

@ -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|

View File

@ -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|

View 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

View File

@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1772,
/**/
1771,
/**/