commit 986b92eb071384dbd4a08c7e8f7d9b93c92b6aba
parent 7ba0f623d75a3ad0c00c376b20a5f5e6acebebec
Author: luukvbaal <luukvbaal@gmail.com>
Date: Mon, 21 Apr 2025 16:51:47 +0200
fix(messages): single msg_show event for multiple :set options #33555
Problem: :set opt1 opt2... emits a separate event for each option.
Solution: Only set the kind for the first printed option value.
Diffstat:
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/nvim/option.c b/src/nvim/option.c
@@ -1282,10 +1282,10 @@ static void do_one_set_option(int opt_flags, char **argp, bool *did_show, char *
if (*did_show) {
msg_putchar('\n'); // cursor below last one
} else {
+ msg_ext_set_kind("list_cmd");
gotocmdline(true); // cursor at status line
*did_show = true; // remember that we did a line
}
- msg_ext_set_kind("list_cmd");
showoneopt(&options[opt_idx], opt_flags);
if (p_verbose > 0) {
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
@@ -1605,12 +1605,11 @@ stack traceback:
it('g< mapping shows recent messages', function()
command('echo "foo" | echo "bar"')
- local s1 = [[
- ^ |
- {1:~ }|*4
- ]]
screen:expect({
- grid = s1,
+ grid = [[
+ ^ |
+ {1:~ }|*4
+ ]],
messages = {
{
content = { { 'bar' } },
@@ -1644,6 +1643,23 @@ stack traceback:
},
})
end)
+
+ it('single event for multiple :set options', function()
+ command('set sw ts sts')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*4
+ ]],
+ messages = {
+ {
+ content = { { ' shiftwidth=8\n tabstop=8\n softtabstop=0' } },
+ history = false,
+ kind = 'list_cmd',
+ },
+ },
+ })
+ end)
end)
describe('ui/builtin messages', function()