To: vim_dev@googlegroups.com Subject: Patch 9.0.0819 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ [ I hope I got this right, please suggest a fix if you see something wrong ] Patch 9.0.0819 (after 9.0.0817) Problem: Still a build error, tests are failing. Solution: Correct recent changes. Add missing init for 'eof'. Files: src/buffer.c, src/change.c, src/fileio.c, src/structs.h, src/testdir/test_fixeol.vim *** ../vim-9.0.0816/src/buffer.c 2022-10-18 17:05:49.652657029 +0100 --- src/buffer.c 2022-10-29 18:27:24.124527845 +0100 *************** *** 790,795 **** --- 790,797 ---- buf->b_ml.ml_line_count = 1; unchanged(buf, TRUE, TRUE); buf->b_shortname = FALSE; + buf->b_p_eof = FALSE; + buf->b_start_eof = FALSE; buf->b_p_eol = TRUE; buf->b_start_eol = TRUE; buf->b_p_bomb = FALSE; *** ../vim-9.0.0816/src/change.c 2022-10-16 21:43:03.386665520 +0100 --- src/change.c 2022-10-29 18:13:26.478868686 +0100 *************** *** 921,926 **** --- 921,927 ---- save_file_ff(buf_T *buf) { buf->b_start_ffc = *buf->b_p_ff; + buf->b_start_eof = buf->b_p_eof; buf->b_start_eol = buf->b_p_eol; buf->b_start_bomb = buf->b_p_bomb; *************** *** 955,961 **** return FALSE; if (buf->b_start_ffc != *buf->b_p_ff) return TRUE; ! if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol) return TRUE; if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) return TRUE; --- 956,964 ---- return FALSE; if (buf->b_start_ffc != *buf->b_p_ff) return TRUE; ! if ((buf->b_p_bin || !buf->b_p_fixeol) ! && (buf->b_start_eof != buf->b_p_eof ! || buf->b_start_eol != buf->b_p_eol)) return TRUE; if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb) return TRUE; *** ../vim-9.0.0816/src/fileio.c 2022-10-22 10:06:38.428322861 +0100 --- src/fileio.c 2022-10-29 18:26:50.644564581 +0100 *************** *** 589,596 **** // correctly set when reading stdin. if (!read_buffer) { - curbuf->b_p_eol = TRUE; curbuf->b_p_eof = FALSE; curbuf->b_start_eol = TRUE; } curbuf->b_p_bomb = FALSE; --- 589,597 ---- // correctly set when reading stdin. if (!read_buffer) { 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,2292 **** if (!error && !got_int && linerest != 0 && !(!curbuf->b_p_bin ! && fileformat == EOL_DOS)) { // 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; } *ptr = NUL; len = (colnr_T)(ptr - line_start + 1); --- 2279,2296 ---- if (!error && !got_int && linerest != 0 + // TODO: should we handle CTRL-Z differently here for 'endoffile'? && !(!curbuf->b_p_bin ! && 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 = TRUE; } *ptr = NUL; len = (colnr_T)(ptr - line_start + 1); *** ../vim-9.0.0816/src/structs.h 2022-10-22 10:06:38.428322861 +0100 --- src/structs.h 2022-10-29 16:21:35.432026323 +0100 *************** *** 3150,3155 **** --- 3150,3156 ---- linenr_T b_no_eol_lnum; // non-zero lnum when last line of next binary // write should not have an end-of-line + int b_start_eof; // last line had eof (CTRL-Z) when it was read int b_start_eol; // last line had eol when it was read int b_start_ffc; // first char of 'ff' when edit started char_u *b_start_fenc; // 'fileencoding' when edit started or NULL *** ../vim-9.0.0816/src/testdir/test_fixeol.vim 2022-10-22 10:06:38.428322861 +0100 --- src/testdir/test_fixeol.vim 2022-10-29 19:49:44.709680576 +0100 *************** *** 34,43 **** w >>XXTestEol w >>XXTestNoEol ! call assert_equal(['with eol', 'END'], readfile('XXEol')) ! call assert_equal(['without eolEND'], readfile('XXNoEol')) ! call assert_equal(['with eol', 'stays eol', 'END'], readfile('XXTestEol')) ! call assert_equal(['without eol', 'stays withoutEND'], \ readfile('XXTestNoEol')) call delete('XXEol') --- 34,43 ---- w >>XXTestEol w >>XXTestNoEol ! call assert_equal(['with eol or eof', 'END'], readfile('XXEol')) ! call assert_equal(['without eol or eofEND'], readfile('XXNoEol')) ! call assert_equal(['with eol or eof', 'stays eol', 'END'], readfile('XXTestEol')) ! call assert_equal(['without eol or eof', 'stays withoutEND'], \ readfile('XXTestNoEol')) call delete('XXEol') *** ../vim-9.0.0816/src/version.c 2022-10-22 10:06:38.428322861 +0100 --- src/version.c 2022-10-29 16:16:34.475916555 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 819, /**/ -- I have read and understood the above. X________________ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///