diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-03-03 23:48:12 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-03-03 23:50:45 +0900 |
commit | 242c0db26b9a14e164ea70bbe1b7b23594381829 (patch) | |
tree | 5fdc7b5211407f81048258d2c20cba751fcd4eb6 | |
parent | dd49e41c424ad0cbef6ca0a0f52d918053f329ea (diff) |
[vim] Fix height calculation
Fix #1418
e.g.
call fzf#run({'source': [1, 2, 3], 'down': '~50%', 'options': "--border --header $'1\n2'"})
-rw-r--r-- | plugin/fzf.vim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 2948595f..6fa3d14d 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 |