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().
diff --git a/src/popupwin.c b/src/popupwin.c
index aae5465..f9cbcef 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -32,6 +32,9 @@
// 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.
@@ -4379,6 +4382,16 @@
#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)
{
#ifdef FEAT_QUICKFIX
@@ -4537,7 +4550,11 @@
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 @@
/*
* 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;
}
/*