0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0683: cannot specify a time for :echowindow

Problem:    Cannot specify a time for :echowindow.
Solution:   A count can be used to specify the display time. Add
            popup_findecho().
This commit is contained in:
Bram Moolenaar
2022-10-07 14:31:45 +01:00
parent cf3d0eaf47
commit bdc09a18fc
21 changed files with 147 additions and 25 deletions

View File

@@ -32,6 +32,9 @@ static poppos_entry_T poppos_entries[] = {
// Window used for ":echowindow"
static win_T *message_win = NULL;
// Time used for the next ":echowindow" message in msec.
static int message_win_time = 3000;
// Flag set when a message is added to the message window, timer is started
// when the message window is drawn. This might be after pressing Enter at the
// hit-enter prompt.
@@ -4378,6 +4381,16 @@ popup_find_info_window(void)
}
#endif
void
f_popup_findecho(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef HAS_MESSAGE_WINDOW
rettv->vval.v_number = message_win == NULL ? 0 : message_win->w_id;
#else
rettv->vval.v_number = 0;
#endif
}
void
f_popup_findinfo(typval_T *argvars UNUSED, typval_T *rettv)
{
@@ -4537,7 +4550,11 @@ may_start_message_win_timer(win_T *wp)
if (wp == message_win && start_message_win_timer)
{
if (message_win->w_popup_timer != NULL)
{
message_win->w_popup_timer->tr_interval = message_win_time;
timer_start(message_win->w_popup_timer);
message_win_time = 3000;
}
start_message_win_timer = FALSE;
}
}
@@ -4568,15 +4585,18 @@ static int ew_msg_col = 0;
/*
* Invoked before outputting a message for ":echowindow".
* "time_sec" is the display time, zero means using the default 3 sec.
*/
void
start_echowindow(void)
start_echowindow(int time_sec)
{
in_echowindow = TRUE;
save_msg_didout = msg_didout;
save_msg_col = msg_col;
msg_didout = ew_msg_didout;
msg_col = ew_msg_col;
if (time_sec != 0)
message_win_time = time_sec * 1000;
}
/*