feat: accept custom border character arrays (#715)

Allow users to pass a custom border table instead of just preset
strings. Supports a table { border_chars, junction_chars } and falls
back to existing preset system when a string is passed
This commit is contained in:
jadonwb
2026-07-27 16:32:12 -05:00
committed by GitHub
parent fde8c52a29
commit 6a239e9875
3 changed files with 9 additions and 1 deletions
+5
View File
@@ -309,6 +309,11 @@ require('fff').setup({
-- Border style for the picker windows. Leave unset (nil) to follow the
-- global `vim.o.winborder`; set it to override fff's borders independently.
border = nil, -- 'single' | 'double' | 'rounded' | 'solid' | 'shadow' | 'none'
-- border = {
-- { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
-- { ' ', ' ', ' ', ' ', ' ', ' ' },
-- },
flex = { size = 130, wrap = 'top' },
min_list_height = 10, -- do not display anything except the list below this threshold
show_scrollbar = true,
+1 -1
View File
@@ -9,7 +9,7 @@ local M = {}
--- @field min_list_height number
--- @field show_scrollbar boolean
--- @field path_shorten_strategy string
--- @field border? 'single'|'double'|'rounded'|'solid'|'shadow'|'none' Border preset; falls back to `vim.o.winborder` when nil
--- @field border? 'single'|'double'|'rounded'|'solid'|'shadow'|'none'|table<string[],string[]> Border preset; falls back to `vim.o.winborder` when nil
--- @class FffPreviewConfig
--- @field enabled boolean
+3
View File
@@ -29,6 +29,9 @@ local function get_border_chars(config)
if border == nil or border == '' then border = vim.o.winborder end
if border == nil or border == '' then border = 'single' end
if type(border) == 'table' then
if #border == 2 and type(border[1]) == 'table' and type(border[2]) == 'table' then return border[1], border[2] end
end
if BORDER_PRESETS[border] then return BORDER_PRESETS[border], T_JUNCTION_PRESETS[border] end
return BORDER_PRESETS.single, T_JUNCTION_PRESETS.single
end