commit b89bc2cce6ec20f50728c3aa83e5c31457acd3b6
parent 8f24ffaaef005b6d8e95b312fa575559d503be81
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 4 Dec 2020 11:50:23 +0100
minibar: show the info bar again some 0.8 seconds after a message
Instead of redisplaying the minibar only upon the next keystroke
(when some feedback message is shown on the status bar), time the
waiting for the keystroke out after four fifths of a second, then
redisplay the minibar and continue the wait.
Diffstat:
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1513,6 +1513,8 @@ void process_a_keystroke(void)
/* Read in a keystroke, and show the cursor while waiting. */
input = get_kbinput(edit, VISIBLE);
+ lastmessage = VACUUM;
+
#ifndef NANO_TINY
if (input == KEY_WINCH)
return;
@@ -2493,6 +2495,10 @@ int main(int argc, char **argv)
openfile->next == openfile && !ISSET(NO_HELP))
statusbar(_("Welcome to nano. For basic help, type Ctrl+G."));
#endif
+#ifndef NANO_TINY
+ if (ISSET(MINIBAR) && lastmessage < ALERT)
+ lastmessage = VACUUM;
+#endif
we_are_running = TRUE;
@@ -2517,7 +2523,6 @@ int main(int argc, char **argv)
if (ISSET(CONSTANT_SHOW) && lastmessage == VACUUM && get_key_buffer_len() == 0)
report_cursor_position();
- lastmessage = VACUUM;
as_an_at = TRUE;
/* Refresh just the cursor position or the entire edit window. */
diff --git a/src/text.c b/src/text.c
@@ -2894,6 +2894,7 @@ void do_linter(void)
refresh_needed = TRUE;
}
+ lastmessage = VACUUM;
currmenu = MMOST;
titlebar(NULL);
}
@@ -3012,7 +3013,7 @@ void do_verbatim_input(void)
/* When something valid was obtained, unsuppress cursor-position display,
* insert the bytes into the edit buffer, and blank the status bar. */
if (count > 0) {
- if (ISSET(CONSTANT_SHOW))
+ if (ISSET(CONSTANT_SHOW) || ISSET(MINIBAR))
lastmessage = VACUUM;
if (count < 999)
diff --git a/src/winio.c b/src/winio.c
@@ -174,6 +174,9 @@ void read_keys_from(WINDOW *win)
{
int input = ERR;
size_t errcount = 0;
+#ifndef NANO_TINY
+ bool timed = FALSE;
+#endif
/* Before reading the first keycode, display any pending screen updates. */
doupdate();
@@ -181,6 +184,14 @@ void read_keys_from(WINDOW *win)
if (reveal_cursor)
curs_set(1);
+#ifndef NANO_TINY
+ if (currmenu == MMAIN && ISSET(MINIBAR) &&
+ lastmessage > VACUUM && lastmessage < ALERT) {
+ timed = TRUE;
+ halfdelay(8);
+ }
+#endif
+
/* Read in the first keycode, waiting for it to arrive. */
while (input == ERR) {
input = wgetch(win);
@@ -190,6 +201,18 @@ void read_keys_from(WINDOW *win)
regenerate_screen();
input = KEY_WINCH;
}
+
+ if (timed) {
+ timed = FALSE;
+ raw();
+
+ if (input == ERR) {
+ minibar();
+ place_the_cursor();
+ doupdate();
+ continue;
+ }
+ }
#endif
/* When we've failed to get a keycode over a hundred times in a row,
* assume our input source is gone and die gracefully. We could