commit 7f8851caa816734c7df3a6c8be1529412e7ac419
parent bfdc31fbb4d05880a5ec6a3a6467385447e62e8c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 12 Oct 2019 14:17:30 +0200
statusbar: show only the first error message, with dots to indicate more
The old default behavior of showing the first three messages with a
long pause after each of them was annoying, and the final "Further
messages were suppressed" hid the relevant information. So, when
there is more than one error message, just pause very briefly and
then add trailing dots to the first message.
This makes the 'nopauses' option a no-op.
This addresses https://savannah.gnu.org/bugs/?57048.
Diffstat:
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -2184,10 +2184,9 @@ void warn_and_shortly_pause(const char *msg)
void statusline(message_type importance, const char *msg, ...)
{
va_list ap;
- static int alerts = 0;
int colorpair;
char *compound, *message;
- size_t start_col;
+ static size_t start_col = 0;
bool bracketed;
#ifndef NANO_TINY
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
@@ -2210,20 +2209,23 @@ void statusline(message_type importance, const char *msg, ...)
}
#endif
- /* 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 && !ISSET(NO_PAUSES))
- napms(1200);
+ /* If there are multiple alert messages, add trailing dots to the first. */
+ if (lastmessage == ALERT) {
+ if (start_col > 4) {
+ wmove(bottomwin, 0, COLS + 2 - start_col);
+ wattron(bottomwin, interface_color_pair[ERROR_MESSAGE]);
+ waddstr(bottomwin, "...");
+ wattroff(bottomwin, interface_color_pair[ERROR_MESSAGE]);
+ wnoutrefresh(bottomwin);
+ start_col = 0;
+ napms(100);
+ beep();
+ }
+ return;
+ }
if (importance == ALERT) {
- if (++alerts > 3 && !ISSET(NO_PAUSES))
- msg = _("Further warnings were suppressed");
- else if (alerts < 4)
- beep();
+ beep();
colorpair = interface_color_pair[ERROR_MESSAGE];
} else if (importance == NOTICE)
colorpair = interface_color_pair[SELECTED_TEXT];