From 6e3a2fe0bf5d53434b41e868c501d9f63c6328aa Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 28 Apr 2021 10:17:46 +0900 Subject: [PATCH] [vim] Fix screen offset of relatively positioned popup window Fix #2461 --- plugin/fzf.vim | 8 ++++---- 1 file 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])