commit 312bcebf4400046e02b65bd35a27d37afef4d0e8
parent eb57b10273244de8721855e326163ea5bcf4e0db
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 2 Aug 2020 10:23:45 +0200
files: do not try writing to the status bar while not in curses mode
Between an endwin() and a doupdate() there should be no calls of
statusline() or statusbar() -- these two functions may be called
only when in curses mode.
This fixes https://savannah.gnu.org/bugs/?58868.
Bug existed since version 4.3, commit 57390cff.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -658,10 +658,8 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
while ((onevalue = getc_unlocked(f)) != EOF) {
char input = (char)onevalue;
- if (control_C_was_pressed) {
- statusline(ALERT, _("Interrupted"));
+ if (control_C_was_pressed)
break;
- }
/* When the byte before the current one is a CR and we're doing
* format conversion, then strip this CR when it's before a LF
@@ -735,6 +733,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
if (ferror(f) && errornumber != EINTR && errornumber != 0)
statusline(ALERT, strerror(errornumber));
+ if (control_C_was_pressed)
+ statusline(ALERT, _("Interrupted"));
+
fclose(f);
if (fd > 0 && !undoable && !ISSET(VIEW_MODE))