vis: set proper fzf padding in case of numbers or relativenumbers

This commit is contained in:
2025-10-01 21:40:06 +02:00
parent 836267b80e
commit aeb8a78721

View File

@@ -45,6 +45,15 @@ local function merge(a, b)
return c
end
local function padding()
local opt = vis.win.options
local l = 0
if opt.numbers or opt.relativenumbers then
l = #tostring(vis.win.viewport.lines.finish)
end
return '0,0,0,' .. l
end
local mu = #up_keys
local md = #down_keys
local up = merge(up_keys, down_keys)
@@ -137,7 +146,7 @@ local function jump(keys)
end
input = input .. data:sub(k)
local code, out, err = vis:pipe(input, 'fzf --ansi --layout=reverse-list --no-info --no-separator --color gutter:-1 --marker="" --padding 0,0,0,3 --print-query --bind change:accept')
local code, out, err = vis:pipe(input, 'fzf --ansi --layout=reverse-list --no-info --no-separator --color gutter:-1 --marker="" --padding ' .. padding() .. ' --print-query --bind change:accept')
if code ~= 0 then
vis:info(err or ('fzf exit code ' .. code))
else