vim-patch:9.1.1539: completion: messages don't respect 'shm' setting (#34923)

Problem:  completion: messages don't respect 'shm' setting
Solution: Turn off completion messages when 'shortmess' includes "c"
          (Girish Palya).

`:set shortmess+=c` is intended to reduce noise during completion by
suppressing messages.
Previously, some completion messages still appeared regardless of this setting.

This change ensures that **all** completion-related messages are suppressed
when `'c'` is present in `'shortmess'`.

Not entirely sure if the original behavior was intentional. If there's a
reason certain messages were always shown, feel free to close this without
merging.

closes: vim/vim#17737

fe1d3c8af7

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-07-14 06:53:40 +08:00
committed by GitHub
parent 96ec4db3e9
commit f487ae90cf
3 changed files with 69 additions and 11 deletions

View File

@ -1373,4 +1373,33 @@ describe('completion', function()
{5:-- Keyword completion (^N^P) The only match} |
]])
end)
-- oldtest: Test_shortmess()
it('shortmess+=c turns off completion messages', function()
command([[call setline(1, ['hello', 'hullo', 'heee'])]])
feed('Goh<C-N>')
screen:expect([[
hello |
hullo |
heee |
hello^ |
{12:hello }{1: }|
{4:hullo }{1: }|
{4:heee }{1: }|
{5:-- Keyword completion (^N^P) }{6:match 1 of 3} |
]])
feed('<Esc>')
command('set shm+=c')
feed('Sh<C-N>')
screen:expect([[
hello |
hullo |
heee |
hello^ |
{12:hello }{1: }|
{4:hullo }{1: }|
{4:heee }{1: }|
{5:-- INSERT --} |
]])
end)
end)

View File

@ -5059,4 +5059,25 @@ func Test_nonkeyword_trigger()
unlet g:CallCount
endfunc
" Test that option shortmess=c turns off completion messages
func Test_shortmess()
CheckScreendump
let lines =<< trim END
call setline(1, ['hello', 'hullo', 'heee'])
END
call writefile(lines, 'Xpumscript', 'D')
let buf = RunVimInTerminal('-S Xpumscript', #{rows: 12})
call term_sendkeys(buf, "Goh\<C-N>")
call TermWait(buf, 200)
call VerifyScreenDump(buf, 'Test_shortmess_complmsg_1', {})
call term_sendkeys(buf, "\<ESC>:set shm+=c\<CR>")
call term_sendkeys(buf, "Sh\<C-N>")
call TermWait(buf, 200)
call VerifyScreenDump(buf, 'Test_shortmess_complmsg_2', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable