forked from aniani/vim
patch 8.2.2199: first write after setting 'eol' does not have NL added
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)
This commit is contained in:
@@ -676,4 +676,22 @@ func Test_readwrite_file_with_bom()
|
||||
%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
|
||||
|
||||
Reference in New Issue
Block a user