0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place

Problem:    If 'endofline' is set the CTRL-Z may be written in the wrong
            place.
Solution:   Write CTRL-Z at the end of the file.  Update the help to explain
            the possibilities better. (Ken Takata, closes #11486)
This commit is contained in:
K.Takata
2022-11-01 20:36:19 +00:00
committed by Bram Moolenaar
parent 8e0ccb6bc2
commit 3af982196b
6 changed files with 136 additions and 19 deletions

View File

@@ -2050,10 +2050,6 @@ restore_backup:
len = 0;
write_info.bw_start_lnum = lnum;
}
if (!buf->b_p_fixeol && buf->b_p_eof)
// write trailing CTRL-Z
(void)write_eintr(write_info.bw_fd, "\x1a", 1);
// write failed or last line has no EOL: stop here
if (end == 0
|| (lnum == end
@@ -2158,6 +2154,13 @@ restore_backup:
nchars += len;
}
if (!buf->b_p_fixeol && buf->b_p_eof)
{
// write trailing CTRL-Z
(void)write_eintr(write_info.bw_fd, "\x1a", 1);
nchars++;
}
// Stop when writing done or an error was encountered.
if (!checking_conversion || end == 0)
break;