diff --git a/src/files.c b/src/files.c index f25b35bf..b4185cbd 100644 --- 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))