summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-29 20:01:52 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-29 20:01:52 +0100
commit1577537f109d97a975fda9a899cacfb598617767 (patch)
tree2aae6eb208722a06a991f51a064ca9d135be175d /src/fileio.c
parent6ebe4f970b8b398087076a72a7aae6e680fb92da (diff)
patch 9.0.0819v9.0.0819
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index ab867b7c8f..bca827152a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -589,8 +589,9 @@ readfile(
// correctly set when reading stdin.
if (!read_buffer)
{
- curbuf->b_p_eol = TRUE;
curbuf->b_p_eof = FALSE;
+ curbuf->b_start_eof = FALSE;
+ curbuf->b_p_eol = TRUE;
curbuf->b_start_eol = TRUE;
}
curbuf->b_p_bomb = FALSE;
@@ -2278,15 +2279,18 @@ failed:
if (!error
&& !got_int
&& linerest != 0
+ // TODO: should we handle CTRL-Z differently here for 'endoffile'?
&& !(!curbuf->b_p_bin
- && fileformat == EOL_DOS))
+ && fileformat == EOL_DOS
+ && *line_start == Ctrl_Z
+ && ptr == line_start + 1))
{
// remember for when writing
if (set_options)
{
curbuf->b_p_eol = FALSE;
if (*line_start == Ctrl_Z && ptr == line_start + 1)
- curbuf->b_p_eof = FALSE;
+ curbuf->b_p_eof = TRUE;
}
*ptr = NUL;
len = (colnr_T)(ptr - line_start + 1);