mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
feat(messages): "verbose" message kind #31991
This commit is contained in:
@ -96,7 +96,7 @@ EVENTS
|
|||||||
• `msg_show`:
|
• `msg_show`:
|
||||||
• `history` argument indicating if the message was added to the history.
|
• `history` argument indicating if the message was added to the history.
|
||||||
• new message kinds: "bufwrite", "completion", "list_cmd", "lua_print",
|
• new message kinds: "bufwrite", "completion", "list_cmd", "lua_print",
|
||||||
"search_cmd", "undo", "wildlist".
|
"search_cmd", "undo", "verbose", wildlist".
|
||||||
|
|
||||||
HIGHLIGHTS
|
HIGHLIGHTS
|
||||||
|
|
||||||
|
@ -806,6 +806,7 @@ must handle.
|
|||||||
"search_cmd" Entered search command
|
"search_cmd" Entered search command
|
||||||
"search_count" Search count message ("S" flag of 'shortmess')
|
"search_count" Search count message ("S" flag of 'shortmess')
|
||||||
"undo" |:undo| and |:redo| message
|
"undo" |:undo| and |:redo| message
|
||||||
|
"verbose" 'verbose' message
|
||||||
"wildlist" 'wildmode' "list" message
|
"wildlist" 'wildmode' "list" message
|
||||||
"wmsg" Warning ("search hit BOTTOM", |W10|, …)
|
"wmsg" Warning ("search hit BOTTOM", |W10|, …)
|
||||||
New kinds may be added in the future; clients should treat unknown
|
New kinds may be added in the future; clients should treat unknown
|
||||||
|
@ -3324,6 +3324,10 @@ int redirecting(void)
|
|||||||
|| redir_reg || redir_vname || capture_ga != NULL;
|
|| redir_reg || redir_vname || capture_ga != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save and restore message kind when emitting a verbose message.
|
||||||
|
static const char *pre_verbose_kind = NULL;
|
||||||
|
static const char *verbose_kind = "verbose";
|
||||||
|
|
||||||
/// Before giving verbose message.
|
/// Before giving verbose message.
|
||||||
/// Must always be called paired with verbose_leave()!
|
/// Must always be called paired with verbose_leave()!
|
||||||
void verbose_enter(void)
|
void verbose_enter(void)
|
||||||
@ -3331,6 +3335,10 @@ void verbose_enter(void)
|
|||||||
if (*p_vfile != NUL) {
|
if (*p_vfile != NUL) {
|
||||||
msg_silent++;
|
msg_silent++;
|
||||||
}
|
}
|
||||||
|
if (msg_ext_kind != verbose_kind) {
|
||||||
|
pre_verbose_kind = msg_ext_kind;
|
||||||
|
msg_ext_set_kind("verbose");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// After giving verbose message.
|
/// After giving verbose message.
|
||||||
@ -3342,14 +3350,17 @@ void verbose_leave(void)
|
|||||||
msg_silent = 0;
|
msg_silent = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (pre_verbose_kind != NULL) {
|
||||||
|
msg_ext_set_kind(pre_verbose_kind);
|
||||||
|
pre_verbose_kind = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like verbose_enter() and set msg_scroll when displaying the message.
|
/// Like verbose_enter() and set msg_scroll when displaying the message.
|
||||||
void verbose_enter_scroll(void)
|
void verbose_enter_scroll(void)
|
||||||
{
|
{
|
||||||
if (*p_vfile != NUL) {
|
verbose_enter();
|
||||||
msg_silent++;
|
if (*p_vfile == NUL) {
|
||||||
} else {
|
|
||||||
// always scroll up, don't overwrite
|
// always scroll up, don't overwrite
|
||||||
msg_scroll = true;
|
msg_scroll = true;
|
||||||
}
|
}
|
||||||
@ -3358,11 +3369,8 @@ void verbose_enter_scroll(void)
|
|||||||
/// Like verbose_leave() and set cmdline_row when displaying the message.
|
/// Like verbose_leave() and set cmdline_row when displaying the message.
|
||||||
void verbose_leave_scroll(void)
|
void verbose_leave_scroll(void)
|
||||||
{
|
{
|
||||||
if (*p_vfile != NUL) {
|
verbose_leave();
|
||||||
if (--msg_silent < 0) {
|
if (*p_vfile == NUL) {
|
||||||
msg_silent = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cmdline_row = msg_row;
|
cmdline_row = msg_row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,6 +330,56 @@ describe('ui/ext_messages', function()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
feed(':1verbose filter Diff[AC] hi<CR>')
|
||||||
|
screen:expect({
|
||||||
|
cmdline = { {
|
||||||
|
abort = false,
|
||||||
|
} },
|
||||||
|
messages = {
|
||||||
|
{
|
||||||
|
content = {
|
||||||
|
{ '\nDiffAdd ' },
|
||||||
|
{ 'xxx', 22, 30 },
|
||||||
|
{ ' ' },
|
||||||
|
{ 'ctermbg=', 18, 5 },
|
||||||
|
{ '81 ' },
|
||||||
|
{ 'guibg=', 18, 5 },
|
||||||
|
{ 'LightBlue' },
|
||||||
|
},
|
||||||
|
history = false,
|
||||||
|
kind = 'list_cmd',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content = { { '\n\tLast set from Lua (run Nvim with -V1 for more details)' } },
|
||||||
|
history = false,
|
||||||
|
kind = 'verbose',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content = {
|
||||||
|
{ '\nDiffChange ' },
|
||||||
|
{ 'xxx', 4, 31 },
|
||||||
|
{ ' ' },
|
||||||
|
{ 'ctermbg=', 18, 5 },
|
||||||
|
{ '225 ' },
|
||||||
|
{ 'guibg=', 18, 5 },
|
||||||
|
{ 'LightMagenta' },
|
||||||
|
},
|
||||||
|
history = false,
|
||||||
|
kind = 'list_cmd',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content = { { '\n\tLast set from Lua (run Nvim with -V1 for more details)' } },
|
||||||
|
history = false,
|
||||||
|
kind = 'verbose',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||||
|
history = false,
|
||||||
|
kind = 'return_prompt',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it(':echoerr', function()
|
it(':echoerr', function()
|
||||||
|
Reference in New Issue
Block a user