From 5c73edb3c2fd8794661d7c7ac72eed1fc9d36761 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Tue, 15 Oct 2019 10:14:10 +0100 Subject: [PATCH] Fix write_buffer() to not add extra line for dos fileformat --- autoload/gitgutter/diff.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/gitgutter/diff.vim b/autoload/gitgutter/diff.vim index 692ad54..498fe9e 100644 --- a/autoload/gitgutter/diff.vim +++ b/autoload/gitgutter/diff.vim @@ -381,14 +381,14 @@ 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 + if getbufvar(a:bufnr, '&endofline') + call add(bufcontents, '') + endif + let fenc = getbufvar(a:bufnr, '&fileencoding') if fenc !=# &encoding call map(bufcontents, 'iconv(v:val, &encoding, "'.fenc.'")')