mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
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:
@ -5632,7 +5632,9 @@ static int ins_compl_start(void)
|
||||
}
|
||||
|
||||
if (compl_status_adding()) {
|
||||
if (!shortmess(SHM_COMPLETIONMENU)) {
|
||||
edit_submode_pre = _(" Adding");
|
||||
}
|
||||
if (ctrl_x_mode_line_or_eval()) {
|
||||
// Insert a new line, keep indentation but ignore 'comments'.
|
||||
char *old = curbuf->b_p_com;
|
||||
@ -5654,11 +5656,13 @@ static int ins_compl_start(void)
|
||||
compl_startpos.col = compl_col;
|
||||
}
|
||||
|
||||
if (!shortmess(SHM_COMPLETIONMENU)) {
|
||||
if (compl_cont_status & CONT_LOCAL) {
|
||||
edit_submode = _(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
|
||||
} else {
|
||||
edit_submode = _(CTRL_X_MSG(ctrl_x_mode));
|
||||
}
|
||||
}
|
||||
|
||||
// If any of the original typed text has been changed we need to fix
|
||||
// the redo buffer.
|
||||
@ -5685,11 +5689,13 @@ static int ins_compl_start(void)
|
||||
// showmode might reset the internal line pointers, so it must
|
||||
// be called before line = ml_get(), or when this address is no
|
||||
// longer needed. -- Acevedo.
|
||||
if (!shortmess(SHM_COMPLETIONMENU)) {
|
||||
edit_submode_extra = _("-- Searching...");
|
||||
edit_submode_highl = HLF_COUNT;
|
||||
showmode();
|
||||
edit_submode_extra = NULL;
|
||||
ui_flush();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -5822,7 +5828,9 @@ int ins_complete(int c, bool enable_pum)
|
||||
compl_cont_status &= ~CONT_S_IPOS;
|
||||
}
|
||||
|
||||
if (!shortmess(SHM_COMPLETIONMENU)) {
|
||||
ins_compl_show_statusmsg();
|
||||
}
|
||||
|
||||
// Show the popup menu, unless we got interrupted.
|
||||
if (enable_pum && !compl_interrupted) {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user