[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] minibar: show the info bar again some 0.8 seconds after a me
From: |
Benno Schulenberg |
Subject: |
[PATCH 4/7] minibar: show the info bar again some 0.8 seconds after a message |
Date: |
Tue, 15 Dec 2020 10:44:06 +0100 |
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.
---
src/nano.c | 7 ++++++-
src/text.c | 3 ++-
src/winio.c | 23 +++++++++++++++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/nano.c b/src/nano.c
index 535ae897..510d50ca 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1511,6 +1511,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;
@@ -2491,6 +2493,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;
@@ -2515,7 +2521,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
index 3a9ee0ed..0ed285da 100644
--- 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
index fd6e532b..54c0e51d 100644
--- 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
--
2.29.2
- [PATCH 1/7] tweaks: move the displaying of the state letters into a separate function, Benno Schulenberg, 2020/12/15
- [PATCH 2/7] display: add code for showing minimal state-information bar at the bottom, Benno Schulenberg, 2020/12/15
- [PATCH 3/7] options: add --minibar and -_ for activating basic state-information bar, Benno Schulenberg, 2020/12/15
- [PATCH 4/7] minibar: show the info bar again some 0.8 seconds after a message,
Benno Schulenberg <=
- [PATCH 5/7] feedback: differentiate between remarks, mistakes, and information, Benno Schulenberg, 2020/12/15
- [PATCH 6/7] minibar: add an [x/y] "counter" when multiple files are open, Benno Schulenberg, 2020/12/15
- [PATCH 7/7] minibar: show the line count in the bar (at startup and when switching), Benno Schulenberg, 2020/12/15