mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Show overflow sections as 255+ not 256
Resolves: https://github.com/tpope/vim-fugitive/issues/1853
This commit is contained in:
@@ -2465,8 +2465,8 @@ function! s:ReplaceCmd(cmd) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:QueryLog(refspec) abort
|
function! s:QueryLog(refspec, limit) abort
|
||||||
let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0]
|
let lines = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s', a:refspec, '--'])[0]
|
||||||
call map(lines, 'split(v:val, "\t", 1)')
|
call map(lines, 'split(v:val, "\t", 1)')
|
||||||
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
|
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
|
||||||
return lines
|
return lines
|
||||||
@@ -2516,6 +2516,20 @@ function! s:AddSection(label, lines, ...) abort
|
|||||||
call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines))
|
call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:AddLogSection(label, a, b) abort
|
||||||
|
let limit = 256
|
||||||
|
let log = s:QueryLog(a:a . '..' . a:b, limit)
|
||||||
|
if empty(log)
|
||||||
|
return
|
||||||
|
elseif len(log) == limit
|
||||||
|
call remove(log, -1)
|
||||||
|
let label = a:label . ' (' . (limit - 1). '+)'
|
||||||
|
else
|
||||||
|
let label = a:label . ' (' . len(log) . ')'
|
||||||
|
endif
|
||||||
|
call append(line('$'), ['', label] + s:Format(log))
|
||||||
|
endfunction
|
||||||
|
|
||||||
let s:rebase_abbrevs = {
|
let s:rebase_abbrevs = {
|
||||||
\ 'p': 'pick',
|
\ 'p': 'pick',
|
||||||
\ 'r': 'reword',
|
\ 'r': 'reword',
|
||||||
@@ -2767,16 +2781,16 @@ function! fugitive#BufReadStatus() abort
|
|||||||
let staged_end = len(staged) ? line('$') : 0
|
let staged_end = len(staged) ? line('$') : 0
|
||||||
|
|
||||||
if len(pull) && get(props, 'branch.ab') !~# ' -0$'
|
if len(pull) && get(props, 'branch.ab') !~# ' -0$'
|
||||||
call s:AddSection('Unpulled from ' . pull, s:QueryLog(head . '..' . pull))
|
call s:AddLogSection('Unpulled from ' . pull, head, pull)
|
||||||
endif
|
endif
|
||||||
if len(push) && push !=# pull
|
if len(push) && push !=# pull
|
||||||
call s:AddSection('Unpulled from ' . push, s:QueryLog(head . '..' . push))
|
call s:AddLogSection('Unpulled from ' . push, head, push)
|
||||||
endif
|
endif
|
||||||
if len(pull) && push !=# pull
|
if len(pull) && push !=# pull
|
||||||
call s:AddSection('Unpushed to ' . pull, s:QueryLog(pull . '..' . head))
|
call s:AddLogSection('Unpushed to ' . pull, pull, head)
|
||||||
endif
|
endif
|
||||||
if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
|
if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
|
||||||
call s:AddSection('Unpushed to ' . push, s:QueryLog(push . '..' . head))
|
call s:AddLogSection('Unpushed to ' . push, push, head)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal nomodified readonly noswapfile
|
setlocal nomodified readonly noswapfile
|
||||||
@@ -3995,7 +4009,7 @@ function! s:StageSeek(info, fallback) abort
|
|||||||
if empty(info.heading)
|
if empty(info.heading)
|
||||||
return a:fallback
|
return a:fallback
|
||||||
endif
|
endif
|
||||||
let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\+)$', 'wn')
|
let line = search('^' . escape(info.heading, '^$.*[]~\') . ' (\d\++\=)$', 'wn')
|
||||||
if !line
|
if !line
|
||||||
for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, [])
|
for section in get({'Staged': ['Unstaged', 'Untracked'], 'Unstaged': ['Untracked', 'Staged'], 'Untracked': ['Unstaged', 'Staged']}, info.section, [])
|
||||||
let line = search('^' . section, 'wn')
|
let line = search('^' . section, 'wn')
|
||||||
@@ -4224,7 +4238,7 @@ function! s:StageInfo(...) abort
|
|||||||
let index = 0
|
let index = 0
|
||||||
while len(getline(slnum - 1)) && empty(heading)
|
while len(getline(slnum - 1)) && empty(heading)
|
||||||
let slnum -= 1
|
let slnum -= 1
|
||||||
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$')
|
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\++\=)$')
|
||||||
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
||||||
let index += 1
|
let index += 1
|
||||||
endif
|
endif
|
||||||
@@ -4279,7 +4293,7 @@ function! s:Selection(arg1, ...) abort
|
|||||||
let index = 0
|
let index = 0
|
||||||
while empty(heading)
|
while empty(heading)
|
||||||
let slnum -= 1
|
let slnum -= 1
|
||||||
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\+)$')
|
let heading = matchstr(getline(slnum), '^\u\l\+.\{-\}\ze (\d\++\=)$')
|
||||||
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
if empty(heading) && getline(slnum) !~# '^[ @\+-]'
|
||||||
let index += 1
|
let index += 1
|
||||||
endif
|
endif
|
||||||
@@ -4299,7 +4313,7 @@ function! s:Selection(arg1, ...) abort
|
|||||||
let lnum = first - (arg1 == flnum ? 0 : 1)
|
let lnum = first - (arg1 == flnum ? 0 : 1)
|
||||||
let root = s:Tree() . '/'
|
let root = s:Tree() . '/'
|
||||||
while lnum <= last
|
while lnum <= last
|
||||||
let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\+)$')
|
let heading = matchstr(line, '^\u\l\+\ze.\{-\}\ze (\d\++\=)$')
|
||||||
if len(heading)
|
if len(heading)
|
||||||
let template.heading = heading
|
let template.heading = heading
|
||||||
let template.section = matchstr(heading, '^\u\l\+')
|
let template.section = matchstr(heading, '^\u\l\+')
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveS
|
|||||||
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
|
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
|
||||||
syn match fugitiveHelpTag /\S\+/ contained
|
syn match fugitiveHelpTag /\S\+/ contained
|
||||||
|
|
||||||
syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$/
|
syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/
|
||||||
syn cluster fugitiveSection contains=fugitiveSection
|
syn cluster fugitiveSection contains=fugitiveSection
|
||||||
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
|
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
|
||||||
syn match fugitiveCount /(\d\+)/hs=s+1,he=e-1 contained
|
syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained
|
||||||
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
|
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
|
||||||
|
|
||||||
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
|
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
|
||||||
@@ -30,10 +30,10 @@ syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
|
|||||||
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
|
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
|
||||||
|
|
||||||
for s:section in ['Untracked', 'Unstaged', 'Staged']
|
for s:section in ['Untracked', 'Unstaged', 'Staged']
|
||||||
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
|
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\++\=)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
|
||||||
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
|
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
|
||||||
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
|
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
|
||||||
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
|
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
|
||||||
endfor
|
endfor
|
||||||
unlet s:section
|
unlet s:section
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user