From 23c3fd9bcd17c6843d1f513334815e2bdee99157 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Tue, 21 Feb 2017 12:57:11 +0100 Subject: [PATCH] statusbar: display at most three consecutive alert messages Cap the number of pauses when displaying ALERT messages, to avoid making the user wait for ages when tens or hundreds of files were specified on the command line. This fixes https://savannah.gnu.org/bugs/?50362. Reported-by: Mike Frysinger <vapier@gentoo.org> --- src/winio.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/winio.c b/src/winio.c index a0bf879c..09141b13 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2088,6 +2088,7 @@ void warn_and_shortly_pause(const char *msg) void statusline(message_type importance, const char *msg, ...) { va_list ap; + static int alerts = 0; char *compound, *message; size_t start_col; bool bracketed; @@ -2112,12 +2113,20 @@ void statusline(message_type importance, const char *msg, ...) (lastmessage == MILD && importance == HUSH)) return; - /* Delay another alert message, to allow an earlier one to be noticed. */ - if (lastmessage == ALERT) + /* If the ALERT status has been reset, reset the counter. */ + if (lastmessage == HUSH) + alerts = 0; + + /* Shortly pause after each of the first three alert messages, + * to give the user time to read them. */ + if (lastmessage == ALERT && alerts < 4) napms(1200); - if (importance == ALERT) + if (importance == ALERT) { + if (++alerts > 3) + msg = "Some warnings were suppressed"; beep(); + } lastmessage = importance; -- GitLab