diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2021-04-28 10:17:46 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2021-04-28 10:17:46 +0900 |
commit | 6e3a2fe0bf5d53434b41e868c501d9f63c6328aa (patch) | |
tree | 21c93b1a0ec2714778cd5fbfe3063bfcd64def8c | |
parent | 8b0e1f941a419258b0877d9a5f71373d76472043 (diff) |
[vim] Fix screen offset of relatively positioned popup window
Fix #2461
-rw-r--r-- | plugin/fzf.vim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 9cebed48..ee2ee906 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -978,13 +978,13 @@ function! s:popup(opts) abort " Use current window size for positioning relatively positioned popups let columns = relative ? winwidth(0) : &columns - let lines = relative ? winheight(0) : &lines + let lines = relative ? winheight(0) : (&lines - has('nvim')) " Size and position let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(columns * a:opts.width)]), columns]) - let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(lines * a:opts.height)]), lines - has('nvim')]) - let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] : 0) - let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] : 0) + let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(lines * a:opts.height)]), lines]) + let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] - 1 : 0) + let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] - 1 : 0) " Managing the differences let row = min([max([0, row]), &lines - has('nvim') - height]) |