From cb841de3fc993a16cccd99ef4d314781b98daf3f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 17 Sep 2020 19:30:18 +0200 Subject: [PATCH] feedback: make an "Unbound key" message disappear on the next keystroke When nano reports "Unbound key" or "Unknown sequence", this message should stay onscreen only for the relevant keystroke, not for any succeeding keystroke. This addresses https://savannah.gnu.org/bugs/?59119. Bug existed since before version 2.0.6. --- src/nano.c | 1 + src/prototypes.h | 1 + src/winio.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/src/nano.c b/src/nano.c index f1679a1a..fa39cd0e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1310,6 +1310,7 @@ void unbound_key(int code) else statusline(ALERT, _("Unbound key: %c"), code); #endif + set_blankdelay_to_one(); } #ifdef ENABLE_MOUSE diff --git a/src/prototypes.h b/src/prototypes.h index 617d5c60..c283e48b 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -592,6 +592,7 @@ void blank_statusbar(void); void wipe_statusbar(void); void blank_bottombars(void); void check_statusblank(void); +void set_blankdelay_to_one(void); char *display_string(const char *buf, size_t column, size_t span, bool isdata, bool isprompt); void titlebar(const char *path); diff --git a/src/winio.c b/src/winio.c index 2bb1a56b..3ec15201 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1694,6 +1694,12 @@ void check_statusblank(void) edit_refresh(); } +/* Ensure that the status bar will be wiped upon the next keystroke. */ +void set_blankdelay_to_one(void) +{ + statusblank = 1; +} + /* Convert buf into a string that can be displayed on screen. The caller * wants to display buf starting with the given column, and extending for * at most span columns. column is zero-based, and span is one-based, so