patch 9.1.1539: completion: messages don't respect 'shm' setting
Commit:
https://github.com/vim/vim/commit/fe1d3c8af764831aa51a8922ce24a7cfd9e6129d
Author: Girish Palya <[email protected]>
Date: Sun Jul 13 16:53:53 2025 +0200
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/insexpand.c b/src/insexpand.c
index 7e3de60e8..84690e588 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -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)
diff --git a/src/testdir/dumps/Test_shortmess_complmsg_1.dump
b/src/testdir/dumps/Test_shortmess_complmsg_1.dump
new file mode 100644
index 000000000..0b1a0d99c
--- /dev/null
+++ b/src/testdir/dumps/Test_shortmess_complmsg_1.dump
@@ -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
diff --git a/src/testdir/dumps/Test_shortmess_complmsg_2.dump
b/src/testdir/dumps/Test_shortmess_complmsg_2.dump
new file mode 100644
index 000000000..542733b30
--- /dev/null
+++ b/src/testdir/dumps/Test_shortmess_complmsg_2.dump
@@ -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
diff --git a/src/testdir/test_ins_complete.vim
b/src/testdir/test_ins_complete.vim
index 9ee7876c2..1573fbee0 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index f40d51075..f63b16789 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1539,
/**/
1538,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1uayBR-003JMD-3Z%40256bit.org.