From ffab0c9d71bf33529b3dd52783b45652e8b500ad Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 16 Aug 2019 17:05:47 +0200 Subject: [PATCH] Preview: polish hunk parser --- autoload/sy/repo.vim | 2 +- autoload/sy/util.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index f08b5dc..0fa709f 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -284,7 +284,7 @@ function! s:preview_hunk(_sy, vcs, diff) abort for line in a:diff if in_hunk - if line[:2] == '@@ ' + if line[:2] == '@@ ' || empty(line) break endif call add(hunk, line) diff --git a/autoload/sy/util.vim b/autoload/sy/util.vim index 979b80b..ca036ca 100644 --- a/autoload/sy/util.vim +++ b/autoload/sy/util.vim @@ -124,7 +124,7 @@ function! sy#util#popup_create(hunkdiff) abort let winline = winline() let min_height = 6 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]) if diff_height > max_height && max_height < min_height