From 986b92eb071384dbd4a08c7e8f7d9b93c92b6aba Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Mon, 21 Apr 2025 16:51:47 +0200 Subject: [PATCH] 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. --- src/nvim/option.c | 2 +- test/functional/ui/messages_spec.lua | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/nvim/option.c b/src/nvim/option.c index 643ac24e43..5299d2a237 100644 --- 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 index 5b40457df9..fbd05cd9b8 100644 --- 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()