Fix staging partial hunk near EOF lacking newline

This is a blind, untested fix.

Closes https://github.com/tpope/vim-fugitive/issues/1609
This commit is contained in:
Tim Pope
2021-03-13 00:02:43 -05:00
parent a4a9acf44e
commit 977e3c805d

View File

@@ -3554,9 +3554,9 @@ function! s:StageApply(info, reverse, extra) abort
if empty(filter(copy(lines), 'v:val =~# "^[+-]"')) if empty(filter(copy(lines), 'v:val =~# "^[+-]"'))
return -1 return -1
endif endif
while getline(end) =~# '^[-+ ]' while getline(end) =~# '^[-+\ ]'
let end += 1 let end += 1
if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . ' ]' if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . '\ ]'
call add(lines, ' ' . getline(end)[1:-1]) call add(lines, ' ' . getline(end)[1:-1])
endif endif
endwhile endwhile