From 977e3c805d7f8fa0f9169f7d268fe6de93bc5cf3 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 13 Mar 2021 00:02:43 -0500 Subject: [PATCH] Fix staging partial hunk near EOF lacking newline This is a blind, untested fix. Closes https://github.com/tpope/vim-fugitive/issues/1609 --- autoload/fugitive.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d1f5f9f..6343955 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3554,9 +3554,9 @@ function! s:StageApply(info, reverse, extra) abort if empty(filter(copy(lines), 'v:val =~# "^[+-]"')) return -1 endif - while getline(end) =~# '^[-+ ]' + while getline(end) =~# '^[-+\ ]' let end += 1 - if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . ' ]' + if getline(end) =~# '^[' . (a:reverse ? '+' : '-') . '\ ]' call add(lines, ' ' . getline(end)[1:-1]) endif endwhile