commit 77da54c6c6ad0caaabaebad3fd437c02f701657c
parent 6bf52dcc8db01c453a7a3875c0806e8390f194ec
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 23 Mar 2021 16:12:48 +0100
startup: do not store an error message in the record of another buffer
Set the 'format' of a file only when it has been fully read in,
so that this field can be used to indicate that any later error
message cannot be meant for this buffer.
This fixes https://savannah.gnu.org/bugs/?60269.
Bug existed since commit 6bf52dcc from yesterday.
Diffstat:
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/definitions.h b/src/definitions.h
@@ -246,7 +246,7 @@
/* Enumeration types. */
typedef enum {
- NIX_FILE, DOS_FILE, MAC_FILE
+ UNSPECIFIED, NIX_FILE, DOS_FILE, MAC_FILE
} format_type;
typedef enum {
diff --git a/src/files.c b/src/files.c
@@ -83,7 +83,7 @@ void make_new_buffer(void)
openfile->mark = NULL;
openfile->softmark = FALSE;
- openfile->fmt = NIX_FILE;
+ openfile->fmt = UNSPECIFIED;
openfile->undotop = NULL;
openfile->current_undo = NULL;
@@ -821,9 +821,11 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
num_lines), num_lines);
}
#endif
- else
+ else {
+ openfile->fmt = NIX_FILE;
statusline(HUSH, P_("Read %zu line", "Read %zu lines",
num_lines), num_lines);
+ }
/* If we inserted less than a screenful, don't center the cursor. */
if (undoable && less_than_a_screenful(was_lineno, was_leftedge))
diff --git a/src/winio.c b/src/winio.c
@@ -2230,7 +2230,7 @@ void statusline(message_type importance, const char *msg, ...)
va_end(ap);
#ifdef ENABLE_MULTIBUFFER
- if (!we_are_running && importance == ALERT && openfile &&
+ if (!we_are_running && importance == ALERT && openfile && !openfile->fmt &&
!openfile->errormessage && openfile->next != openfile)
openfile->errormessage = copy_of(compound);
#endif