mirror of
https://github.com/vim/vim
synced 2025-07-15 16:51:57 +00:00
patch 9.1.1539: completion: messages don't respect 'shm' setting
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: #17737 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
ce1d1969f3
commit
fe1d3c8af7
@ -6600,7 +6600,8 @@ ins_compl_start(void)
|
||||
|
||||
if (compl_status_adding())
|
||||
{
|
||||
edit_submode_pre = (char_u *)_(" Adding");
|
||||
if (!shortmess(SHM_COMPLETIONMENU))
|
||||
edit_submode_pre = (char_u *)_(" Adding");
|
||||
if (ctrl_x_mode_line_or_eval())
|
||||
{
|
||||
// Insert a new line, keep indentation but ignore 'comments'.
|
||||
@ -6627,10 +6628,13 @@ ins_compl_start(void)
|
||||
compl_startpos.col = compl_col;
|
||||
}
|
||||
|
||||
if (compl_cont_status & CONT_LOCAL)
|
||||
edit_submode = (char_u *)_(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
|
||||
else
|
||||
edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
|
||||
if (!shortmess(SHM_COMPLETIONMENU))
|
||||
{
|
||||
if (compl_cont_status & CONT_LOCAL)
|
||||
edit_submode = (char_u *)_(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
|
||||
else
|
||||
edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
|
||||
}
|
||||
|
||||
// If any of the original typed text has been changed we need to fix
|
||||
// the redo buffer.
|
||||
@ -6655,11 +6659,14 @@ 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.
|
||||
edit_submode_extra = (char_u *)_("-- Searching...");
|
||||
edit_submode_highl = HLF_COUNT;
|
||||
showmode();
|
||||
edit_submode_extra = NULL;
|
||||
out_flush();
|
||||
if (!shortmess(SHM_COMPLETIONMENU))
|
||||
{
|
||||
edit_submode_extra = (char_u *)_("-- Searching...");
|
||||
edit_submode_highl = HLF_COUNT;
|
||||
showmode();
|
||||
edit_submode_extra = NULL;
|
||||
out_flush();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -6821,7 +6828,8 @@ ins_complete(int c, int enable_pum)
|
||||
else
|
||||
compl_cont_status &= ~CONT_S_IPOS;
|
||||
|
||||
ins_compl_show_statusmsg();
|
||||
if (!shortmess(SHM_COMPLETIONMENU))
|
||||
ins_compl_show_statusmsg();
|
||||
|
||||
// Show the popup menu, unless we got interrupted.
|
||||
if (enable_pum && !compl_interrupted)
|
||||
|
12
src/testdir/dumps/Test_shortmess_complmsg_1.dump
Normal file
12
src/testdir/dumps/Test_shortmess_complmsg_1.dump
Normal file
@ -0,0 +1,12 @@
|
||||
|h+0&#ffffff0|e|l@1|o| @69
|
||||
|h|u|l@1|o| @69
|
||||
|h|e@2| @70
|
||||
|h|e|l@1|o> @69
|
||||
|h+0#0000001#e0e0e08|e|l@1|o| @9| +0#4040ff13#ffffff0@59
|
||||
|h+0#0000001#ffd7ff255|u|l@1|o| @9| +0#4040ff13#ffffff0@59
|
||||
|h+0#0000001#ffd7ff255|e@2| @10| +0#4040ff13#ffffff0@59
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@33
|
12
src/testdir/dumps/Test_shortmess_complmsg_2.dump
Normal file
12
src/testdir/dumps/Test_shortmess_complmsg_2.dump
Normal file
@ -0,0 +1,12 @@
|
||||
|h+0&#ffffff0|e|l@1|o| @69
|
||||
|h|u|l@1|o| @69
|
||||
|h|e@2| @70
|
||||
|h|e|l@1|o> @69
|
||||
|h+0#0000001#e0e0e08|e|l@1|o| @9| +0#4040ff13#ffffff0@59
|
||||
|h+0#0000001#ffd7ff255|u|l@1|o| @9| +0#4040ff13#ffffff0@59
|
||||
|h+0#0000001#ffd7ff255|e@2| @10| +0#4040ff13#ffffff0@59
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@62
|
@ -4976,4 +4976,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
|
||||
|
@ -719,6 +719,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1539,
|
||||
/**/
|
||||
1538,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user