Fix :Gstatus X in visual patch selection

This commit is contained in:
Tim Pope 2019-07-23 18:31:55 -04:00
parent 54bc4ab9dd
commit d88a0f8465

View File

@ -1830,8 +1830,8 @@ function! fugitive#BufReadStatus() abort
nnoremap <buffer> <silent> R :echohl WarningMsg<Bar>echo 'Reloading is automatic. Use :e to force'<Bar>echohl NONE<CR>
nnoremap <buffer> <silent> g<Bar> :<C-U>echoerr 'Changed to X'<CR>
xnoremap <buffer> <silent> g<Bar> :<C-U>echoerr 'Changed to X'<CR>
nnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line('.'), line('.'), v:count)<CR>
xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"), line("'<"), v:count)<CR>
nnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line('.'), 0, v:count)<CR>
xnoremap <buffer> <silent> X :<C-U>execute <SID>StageDelete(line("'<"), line("'>"), v:count)<CR>
nnoremap <buffer> . :<C-U> <C-R>=<SID>StageArgs(0)<CR><Home>
xnoremap <buffer> . :<C-U> <C-R>=<SID>StageArgs(1)<CR><Home>
nnoremap <buffer> <silent> <F1> :help fugitive-mappings<CR>
@ -2835,8 +2835,8 @@ function! s:StageApply(info, reverse, extra) abort
call s:throw(output)
endfunction
function! s:StageDelete(lnum, ignored, count) abort
let info = get(s:Selection(a:lnum, a:lnum), 0, {'filename': ''})
function! s:StageDelete(lnum1, lnum2, count) abort
let info = get(s:Selection(a:lnum1, a:lnum2), 0, {'filename': ''})
if empty(info.filename)
return ''
endif
@ -2845,7 +2845,7 @@ function! s:StageDelete(lnum, ignored, count) abort
if empty(hash)
return ''
elseif info.patch
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
call s:StageApply(info, 1, info.section ==# 'Staged' ? ['--index'] : [])
elseif info.status ==# '?'
call s:TreeChomp('clean', '-f', '--', info.paths[0])
elseif a:count == 2