Do not write EOL after last line when no EOL present

See #650.
This commit is contained in:
Andy Stewart
2019-09-19 12:20:42 +01:00
parent 92deed378d
commit 12bb0e9634

View File

@@ -381,6 +381,10 @@ function! s:write_buffer(bufnr, file)
return
endif
if getbufvar(a:bufnr, '&endofline')
call add(bufcontents, '')
endif
if getbufvar(a:bufnr, '&fileformat') ==# 'dos'
call map(bufcontents, 'v:val."\r"')
endif
@@ -394,7 +398,7 @@ function! s:write_buffer(bufnr, file)
let bufcontents[0]=''.bufcontents[0]
endif
call writefile(bufcontents, a:file)
call writefile(bufcontents, a:file, 'b')
endfunction