Support WIDE COLON in :Gstatus in some locales

Closes #228.
This commit is contained in:
Tim Pope 2013-01-09 23:11:30 -05:00
parent 582eb0d3c9
commit b9525df190

View File

@ -682,17 +682,18 @@ endfunction
function! s:stage_info(lnum) abort function! s:stage_info(lnum) abort
let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
let lnum = a:lnum let lnum = a:lnum
while lnum && getline(lnum) !~# '^#.*:$' let colon = '\%(:\|\%uff1a\)'
while lnum && getline(lnum) !~# colon.'$'
let lnum -= 1 let lnum -= 1
endwhile endwhile
if !lnum if !lnum
return ['', ''] return ['', '']
elseif getline(lnum+1) =~# '^# .*"git \%(reset\|rm --cached\) ' || getline(lnum) ==# '# Changes to be committed:' elseif getline(lnum+1) =~# '^# .*"git \%(reset\|rm --cached\) ' || getline(lnum) ==# '# Changes to be committed:'
return [matchstr(filename, ': *\zs.*'), 'staged'] return [matchstr(filename, colon.' *\zs.*'), 'staged']
elseif getline(lnum+2) =~# '^# .*"git checkout ' || getline(lnum) ==# '# Changes not staged for commit:' elseif getline(lnum+2) =~# '^# .*"git checkout ' || getline(lnum) ==# '# Changes not staged for commit:'
return [matchstr(filename, ': *\zs.*'), 'unstaged'] return [matchstr(filename, colon.' *\zs.*'), 'unstaged']
elseif getline(lnum+1) =~# '^# .*"git add/rm ' || getline(lnum) ==# '# Unmerged paths:' elseif getline(lnum+1) =~# '^# .*"git add/rm ' || getline(lnum) ==# '# Unmerged paths:'
return [matchstr(filename, ': *\zs.*'), 'unmerged'] return [matchstr(filename, colon.' *\zs.*'), 'unmerged']
else else
return [filename, 'untracked'] return [filename, 'untracked']
endif endif
@ -718,14 +719,14 @@ endfunction
function! s:StageReloadSeek(target,lnum1,lnum2) function! s:StageReloadSeek(target,lnum1,lnum2)
let jump = a:target let jump = a:target
let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
if f !=# '' | let jump = f | endif if f !=# '' | let jump = f | endif
let f = matchstr(getline(a:lnum2+1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*') let f = matchstr(getline(a:lnum2+1),'^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*')
if f !=# '' | let jump = f | endif if f !=# '' | let jump = f | endif
silent! edit! silent! edit!
1 1
redraw redraw
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.jump.'\%( ([^()[:digit:]]\+)\)\=\$','W') call search('^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\V'.jump.'\%( ([^()[:digit:]]\+)\)\=\$','W')
endfunction endfunction
function! s:StageDiff(diff) abort function! s:StageDiff(diff) abort