Patch 8.2.2199
Problem: First write after setting 'eol' does not have NL added. (Tomáš
Janoušek)
Solution: Only use b_no_eol_lnum when doing a binary write. (closes #7535)
Files: src/bufwrite.c, src/testdir/test_writefile.vim
*** ../vim-8.2.2198/src/bufwrite.c 2020-12-18 19:49:52.337571884 +0100
--- src/bufwrite.c 2020-12-23 18:48:59.402936918 +0100
***************
*** 2031,2037 ****
if (end == 0
|| (lnum == end
&& (write_bin || !buf->b_p_fixeol)
! && (lnum == buf->b_no_eol_lnum
|| (lnum == buf->b_ml.ml_line_count
&& !buf->b_p_eol))))
{
--- 2031,2037 ----
if (end == 0
|| (lnum == end
&& (write_bin || !buf->b_p_fixeol)
! && ((write_bin && lnum == buf->b_no_eol_lnum)
|| (lnum == buf->b_ml.ml_line_count
&& !buf->b_p_eol))))
{
*** ../vim-8.2.2198/src/testdir/test_writefile.vim 2020-09-04
21:18:40.492161906 +0200
--- src/testdir/test_writefile.vim 2020-12-23 18:49:48.254787611 +0100
***************
*** 676,679 ****
--- 676,697 ----
%bw!
endfunc
+ func Test_read_write_bin()
+ " write file missing EOL
+ call writefile(['noeol'], "XNoEolSetEol", 'bS')
+ call assert_equal(0z6E6F656F6C, readfile('XNoEolSetEol', 'B'))
+
+ " when file is read 'eol' is off
+ set ff=unix nofixeol
+ e XNoEolSetEol
+ call assert_equal(0, &eol)
+
+ " writing with 'eol' set adds the newline
+ setlocal eol
+ w
+ call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B'))
+
+ call delete('XNoEolSetEol')
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2198/src/version.c 2020-12-23 14:35:56.963016983 +0100
--- src/version.c 2020-12-23 18:51:06.278547383 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2199,
/**/
--
hundred-and-one symptoms of being an internet addict:
19. All of your friends have an @ in their names.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012231755.0BNHtRlb2951422%40masaka.moolenaar.net.