mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 14:56:08 +00:00
feat(messages): "verbose" message kind #31991
This commit is contained in:
@@ -3324,6 +3324,10 @@ int redirecting(void)
|
||||
|| 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.
|
||||
/// Must always be called paired with verbose_leave()!
|
||||
void verbose_enter(void)
|
||||
@@ -3331,6 +3335,10 @@ void verbose_enter(void)
|
||||
if (*p_vfile != NUL) {
|
||||
msg_silent++;
|
||||
}
|
||||
if (msg_ext_kind != verbose_kind) {
|
||||
pre_verbose_kind = msg_ext_kind;
|
||||
msg_ext_set_kind("verbose");
|
||||
}
|
||||
}
|
||||
|
||||
/// After giving verbose message.
|
||||
@@ -3342,14 +3350,17 @@ void verbose_leave(void)
|
||||
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.
|
||||
void verbose_enter_scroll(void)
|
||||
{
|
||||
if (*p_vfile != NUL) {
|
||||
msg_silent++;
|
||||
} else {
|
||||
verbose_enter();
|
||||
if (*p_vfile == NUL) {
|
||||
// always scroll up, don't overwrite
|
||||
msg_scroll = true;
|
||||
}
|
||||
@@ -3358,11 +3369,8 @@ void verbose_enter_scroll(void)
|
||||
/// Like verbose_leave() and set cmdline_row when displaying the message.
|
||||
void verbose_leave_scroll(void)
|
||||
{
|
||||
if (*p_vfile != NUL) {
|
||||
if (--msg_silent < 0) {
|
||||
msg_silent = 0;
|
||||
}
|
||||
} else {
|
||||
verbose_leave();
|
||||
if (*p_vfile == NUL) {
|
||||
cmdline_row = msg_row;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user