From 242c0db26b9a14e164ea70bbe1b7b23594381829 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 3 Mar 2020 23:48:12 +0900 Subject: [PATCH] [vim] Fix height calculation Fix #1418 e.g. call fzf#run({'source': [1, 2, 3], 'down': '~50%', 'options': "--border --header $'1\n2'"}) --- plugin/fzf.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 2948595..6fa3d14 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -642,9 +642,11 @@ function! s:calc_size(max, val, dict) endif let opts = $FZF_DEFAULT_OPTS.' '.s:evaluate_opts(get(a:dict, 'options', '')) - let margin = stridx(opts, '--inline-info') > stridx(opts, '--no-inline-info') ? 1 : 2 + let margin = match(opts, '--inline-info\|--info[^-]\{-}inline') > match(opts, '--no-inline-info\|--info[^-]\{-}\(default\|hidden\)') ? 1 : 2 let margin += stridx(opts, '--border') > stridx(opts, '--no-border') ? 2 : 0 - let margin += stridx(opts, '--header') > stridx(opts, '--no-header') + if stridx(opts, '--header') > stridx(opts, '--no-header') + let margin += len(split(opts, "\n")) + endif return srcsz >= 0 ? min([srcsz + margin, size]) : size endfunction