vim-patch:9.1.1772: completion: inconsistent selection of first item with 'autocomplete' (#35835)

Problem:  completion: inconsistent selection of first item with
          'autocomplete' (Tomasz N)
Solution: Check for 'autocomplete' option in ins_compl_new_leader()
          (Girish Palya).

fixes: vim/vim#18326
closes: vim/vim#18329

86e8e909f2

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-19 10:47:53 +08:00
committed by GitHub
parent 95267b664c
commit e2166661d4
3 changed files with 69 additions and 2 deletions

View File

@@ -1413,11 +1413,11 @@ describe('completion', function()
-- oldtest: Test_autocompletedelay()
it("'autocompletedelay' option", function()
screen:try_resize(60, 10)
source([[
call setline(1, ['foo', 'foobar', 'foobarbaz'])
set autocomplete
]])
screen:try_resize(60, 10)
screen:expect([[
^foo |
foobar |
@@ -1579,4 +1579,48 @@ describe('completion', function()
feed('<esc>')
end)
it([[first item isn't selected with "fuzzy" and 'acl']], function()
screen:try_resize(60, 10)
source([[
call setline(1, ["v", "vi", "vim"])
set autocomplete completeopt=menuone,noinsert,fuzzy autocompletedelay=300
]])
feed('Govi')
screen:expect([[
v |
vi |
vim |
vi^ |
{4:vi }{1: }|
{4:vim }{1: }|
{1:~ }|*3
{5:-- INSERT --} |
]])
feed('<Esc>Sv')
screen:expect([[
v |
vi |
vim |
v^ |
{4:v }{1: }|
{4:vi }{1: }|
{4:vim }{1: }|
{1:~ }|*2
{5:-- INSERT --} |
]])
feed('i')
screen:expect([[
v |
vi |
vim |
vi^ |
{4:vi }{1: }|
{4:vim }{1: }|
{1:~ }|*3
{5:-- INSERT --} |
]])
end)
end)