nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] statusbar: show only the first error message, with


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] statusbar: show only the first error message, with dots to indicate more
Date: Sat, 12 Oct 2019 15:49:03 +0200

This addresses https://savannah.gnu.org/bugs/?57048.
---
 src/winio.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index f3290097..e8abce76 100644
--- 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,20 @@ 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);
+               }
+               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];
-- 
2.23.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]