diff options
author | luukvbaal <luukvbaal@gmail.com> | 2025-02-21 01:40:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-20 16:40:21 -0800 |
commit | 08f7c2237767e75e2398c057aed0f10740c487b0 (patch) | |
tree | 3bd4f108f0f58345ade206c371fe7f498cbc9834 /src | |
parent | f4cd5a33b6b06fe77652e19eba46af107de36a2b (diff) | |
download | rneovim-08f7c2237767e75e2398c057aed0f10740c487b0.tar.gz rneovim-08f7c2237767e75e2398c057aed0f10740c487b0.tar.bz2 rneovim-08f7c2237767e75e2398c057aed0f10740c487b0.zip |
fix(messages): list_cmd kind for :registers, :au[g] #32531
Problem: No kind for `:registers/autocmd/augroup` messages. `:registers`
chunks are emitted as separate `msg_show` events.
Solution: Add the `list_cmd` kind to the message. Introduce a new
`msg_ext_skip_flush` variable to set to true around a
group of to be paired message chunks.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/autocmd.c | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 2 | ||||
-rw-r--r-- | src/nvim/message.h | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 11 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index ad27823667..34ad734528 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -554,6 +554,7 @@ void do_augroup(char *arg, bool del_group) current_augroup = augroup_add(arg); } else { // ":aug": list the group names msg_start(); + msg_ext_set_kind("list_cmd"); String name; int value; @@ -855,6 +856,7 @@ void do_autocmd(exarg_T *eap, char *arg_in, int forceit) // Print header when showing autocommands. if (is_showing) { // Highlight title + msg_ext_set_kind("list_cmd"); msg_puts_title(_("\n--- Autocommands ---")); if (*arg == '*' || *arg == '|' || *arg == NUL) { diff --git a/src/nvim/message.c b/src/nvim/message.c index 6fc102e4ff..ef4cde8a80 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -3162,6 +3162,8 @@ void msg_ext_ui_flush(void) if (!ui_has(kUIMessages)) { msg_ext_kind = NULL; return; + } else if (msg_ext_skip_flush) { + return; } msg_ext_emit_chunk(); diff --git a/src/nvim/message.h b/src/nvim/message.h index 13746406f9..55c58114f4 100644 --- a/src/nvim/message.h +++ b/src/nvim/message.h @@ -34,6 +34,8 @@ extern MessageHistoryEntry *first_msg_hist; extern MessageHistoryEntry *last_msg_hist; EXTERN bool msg_ext_need_clear INIT( = false); +// Set to true to force grouping a set of message chunks into a single `cmdline_show` event. +EXTERN bool msg_ext_skip_flush INIT( = false); /// allocated grid for messages. Used when display+=msgsep is set, or /// ext_multigrid is active. See also the description at msg_scroll_flush() diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2491621fbc..6c437bcb2c 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3770,10 +3770,16 @@ void ex_display(exarg_T *eap) } int hl_id = HLF_8; + msg_ext_set_kind("list_cmd"); + msg_ext_skip_flush = true; // Highlight title msg_puts_title(_("\nType Name Content")); for (int i = -1; i < NUM_REGISTERS && !got_int; i++) { int name = get_register_name(i); + if (arg != NULL && vim_strchr(arg, name) == NULL) { + continue; // did not ask for this register + } + switch (get_reg_type(name, NULL)) { case kMTLineWise: type = 'l'; break; @@ -3783,10 +3789,6 @@ void ex_display(exarg_T *eap) type = 'b'; break; } - if (arg != NULL && vim_strchr(arg, name) == NULL) { - continue; // did not ask for this register - } - if (i == -1) { if (y_previous != NULL) { yb = y_previous; @@ -3890,6 +3892,7 @@ void ex_display(exarg_T *eap) msg_puts("\n c \"= "); dis_msg(expr_line, false); } + msg_ext_skip_flush = false; } /// display a string for do_dis() |