Skip to content
Myr

[vim] Fix screen offset of relatively positioned popup window

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #2461

authored by Junegunn Choi · committed by Junegunn Choi · parent 8b0e1f9 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:plugin/fzf.vim+4 added-4 removed
976 unmodified lines
977 let relative = get(a:opts, 'relative', 0)978979 " Use current window size for positioning relatively positioned popups980 let columns = relative ? winwidth(0) : &columns981 let lines = relative ? winheight(0) : &lines981 let lines = relative ? winheight(0) : (&lines - has('nvim'))982983 " Size and position984 let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(columns * a:opts.width)]), columns])985 let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(lines * a:opts.height)]), lines - has('nvim')])986 let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] : 0)987 let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] : 0)985 let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(lines * a:opts.height)]), lines])986 let row = float2nr(yoffset * (lines - height)) + (relative ? win_screenpos(0)[0] - 1 : 0)987 let col = float2nr(xoffset * (columns - width)) + (relative ? win_screenpos(0)[1] - 1 : 0)988989 " Managing the differences990 let row = min([max([0, row]), &lines - has('nvim') - height])991 let col = min([max([0, col]), &columns - width])
44 unmodified lines