Preview: polish hunk parser
This commit is contained in:
parent
8b9eea5782
commit
ffab0c9d71
@ -284,7 +284,7 @@ function! s:preview_hunk(_sy, vcs, diff) abort
|
|||||||
|
|
||||||
for line in a:diff
|
for line in a:diff
|
||||||
if in_hunk
|
if in_hunk
|
||||||
if line[:2] == '@@ '
|
if line[:2] == '@@ ' || empty(line)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
call add(hunk, line)
|
call add(hunk, line)
|
||||||
|
@ -124,7 +124,7 @@ function! sy#util#popup_create(hunkdiff) abort
|
|||||||
let winline = winline()
|
let winline = winline()
|
||||||
let min_height = 6
|
let min_height = 6
|
||||||
let max_height = winheight('%') - winline
|
let max_height = winheight('%') - winline
|
||||||
let diff_height = len(filter(a:hunkdiff, {_,v -> !empty(v)}))
|
let diff_height = len(a:hunkdiff)
|
||||||
let height = min([diff_height, max_height])
|
let height = min([diff_height, max_height])
|
||||||
|
|
||||||
if diff_height > max_height && max_height < min_height
|
if diff_height > max_height && max_height < min_height
|
||||||
|
Loading…
Reference in New Issue
Block a user