commit c9482bcd2b627f1ae7366e6f6508617af1e5c59c
parent 747ce3b5dad2a8bdd4f763d7827f307aadbed2b6
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 21 May 2020 09:12:33 +0200
display: do not try to draw content when there is no open buffer yet
Commit b63c90bf avoided creating an empty buffer before asking the
yes-no question when encountering a lock file at startup, but the
SIGWINCH code still expected to have an open buffer whose contents
to show.
This fix also has the pleasant effect that, when resizing the screen
at the lock-file yes-no prompt, the title bar doesn't suddenly appear.
This fixes https://savannah.gnu.org/bugs/?58414.
Reported-by: Liu Hao <lh_mouse@126.com>
Bug existed since version 4.9, commit b63c90bf.
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -1039,18 +1039,20 @@ void regenerate_screen(void)
#endif
editwincols = COLS - margin;
- /* Ensure that firstcolumn is the starting column of its chunk. */
- ensure_firstcolumn_is_aligned();
-
/* Do as the website suggests: leave and immediately reenter curses mode. */
endwin();
doupdate();
- /* Put the terminal in the desired state again, recreate the subwindows
- * with their (new) sizes, and redraw the contents of these windows. */
+ /* Put the terminal in the desired state again, and
+ * recreate the subwindows with their (new) sizes. */
terminal_init();
window_init();
- total_refresh();
+
+ /* If we have an open buffer, redraw the contents of the subwindows. */
+ if (openfile) {
+ ensure_firstcolumn_is_aligned();
+ total_refresh();
+ }
}
/* Handle the global toggle specified in flag. */