Preview: polish hunk parser

This commit is contained in:
Marco Hinz 2019-08-16 17:05:47 +02:00
parent 8b9eea5782
commit ffab0c9d71
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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