commit b574f73e6061895dd3863a56b8db4a37585b78c9
parent eac90c3eff90c5a18cd55fbe4f66ba6ccbb116ef
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 29 Dec 2017 17:34:03 +0100
tweaks: add a separate function that actually wipes the status bar
Diffstat:
7 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -372,8 +372,7 @@ int do_lockfile(const char *filename)
free(promptstr);
if (response < 1) {
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
goto free_the_name;
}
}
@@ -2218,8 +2217,7 @@ int do_writeout(bool exiting, bool withprompt)
response = do_yesno_prompt(FALSE, _("File was modified "
"since you opened it; continue saving? "));
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
/* When in tool mode and not called by 'savefile',
* overwrite the file right here when requested. */
diff --git a/src/nano.c b/src/nano.c
@@ -710,8 +710,7 @@ void window_init(void)
}
/* In case the terminal shrunk, make sure the status line is clear. */
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
/* Turn the keypad on for the windows, if necessary. */
if (!ISSET(REBIND_KEYPAD)) {
diff --git a/src/prompt.c b/src/prompt.c
@@ -651,8 +651,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
else if (func == do_enter)
retval = (*answer == '\0') ? -2 : 0;
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
#ifdef ENABLE_TABCOMP
/* If we've done tab completion, there might still be a list of
@@ -720,8 +719,8 @@ int do_yesno_prompt(bool all, const char *msg)
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, message, actual_x(message, COLS - 1));
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
-
wnoutrefresh(bottomwin);
+
currmenu = MYESNO;
/* When not replacing, show the cursor while waiting for a key. */
diff --git a/src/proto.h b/src/proto.h
@@ -642,6 +642,7 @@ const sc *get_shortcut(int *kbinput);
void blank_row(WINDOW *win, int y, int x, int n);
void blank_edit(void);
void blank_statusbar(void);
+void wipe_statusbar(void);
void blank_bottombars(void);
void check_statusblank(void);
char *display_string(const char *buf, size_t column, size_t span, bool isdata);
diff --git a/src/search.c b/src/search.c
@@ -347,8 +347,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
/* Wipe the "Searching..." message and unset the suppression flag. */
if (feedback > 0) {
- blank_statusbar();
- wrefresh(bottomwin);
+ wipe_statusbar();
suppress_cursorpos = FALSE;
}
diff --git a/src/text.c b/src/text.c
@@ -2502,8 +2502,7 @@ void do_justify(bool full_justify)
/* Mark the buffer for unjustified text as empty. */
jusbuffer = NULL;
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
/* Show "Uncut" again in the help lines, and force their redrawing. */
uncutfunc->desc = uncut_tag;
@@ -3322,8 +3321,7 @@ void do_linter(void)
}
}
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
#ifndef NANO_TINY
free_lints_and_return:
@@ -3546,10 +3544,8 @@ void do_verbatim_input(void)
/* Unsuppress cursor-position display or blank the statusbar. */
if (ISSET(CONSTANT_SHOW))
suppress_cursorpos = FALSE;
- else {
- blank_statusbar();
- wnoutrefresh(bottomwin);
- }
+ else
+ wipe_statusbar();
/* Display all the verbatim characters at once, not filtering out
* control characters. */
@@ -3622,8 +3618,7 @@ void complete_a_word(void)
pletion_x = 0;
/* Wipe the "No further matches" message. */
- blank_statusbar();
- wnoutrefresh(bottomwin);
+ wipe_statusbar();
} else {
/* Remove the attempted completion from the buffer. */
do_undo();
diff --git a/src/winio.c b/src/winio.c
@@ -1810,6 +1810,13 @@ void blank_statusbar(void)
blank_row(bottomwin, 0, 0, COLS);
}
+/* Wipe the status bar clean and include this in the next screen update. */
+void wipe_statusbar(void)
+{
+ blank_row(bottomwin, 0, 0, COLS);
+ wnoutrefresh(bottomwin);
+}
+
/* If the NO_HELP flag isn't set, blank the last two lines of the bottom
* portion of the window. */
void blank_bottombars(void)
@@ -1834,10 +1841,8 @@ void check_statusblank(void)
if (currmenu == MMAIN && ISSET(CONSTANT_SHOW))
return;
- if (statusblank == 0) {
- blank_statusbar();
- wnoutrefresh(bottomwin);
- }
+ if (statusblank == 0)
+ wipe_statusbar();
/* If the subwindows overlap, make sure to show the edit window now. */
if (LINES == 1)