vim-patch:9.1.1121: Enter does not insert newline with "noselect"

Problem:  Enter does not insert newline with "noselect" when the pum is
          visible (lifepillar)
Solution: When Enter is pressed and no complete-item is selected,
          ins_compl_prep returns false, and the edit function continues
          processing Enter to insert a new line. (glepnir)

fixes: vim/vim#1653
closes: vim/vim#16653

07f0dbe3aa

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
glepnir
2025-02-19 13:40:46 +08:00
committed by zeertzjq
parent 99a6cbe540
commit 07785ea9c5
6 changed files with 55 additions and 10 deletions

View File

@@ -506,19 +506,21 @@ describe('completion', function()
]])
end)
it('Enter selects original text after adding leader', function()
it('Enter selects original text after adding leader and insert newline', function()
feed('iJ<C-x><C-u>')
poke_eventloop()
feed('u')
poke_eventloop()
feed('<CR>')
expect('Ju')
expect([[Ju
]])
feed('<Esc>')
poke_eventloop()
-- The behavior should be the same when completion has been interrupted,
-- which can happen interactively if the completion function is slow.
feed('SJ<C-x><C-u>u<CR>')
expect('Ju')
feed('ggVGSJ<C-x><C-u>u<CR>')
expect([[Ju
]])
end)
end)