fix: expand full-border plugin compatibility

This commit is contained in:
三咲雅 · Misaki Masa
2024-06-27 22:38:40 +08:00
committed by GitHub

View File

@@ -3,16 +3,21 @@ local function setup()
local chunks = self:layout(area)
local bar = function(c, x, y)
x, y = math.max(0, x), math.max(0, y)
return ui.Bar(ui.Rect { x = x, y = y, w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) }, ui.Bar.TOP)
:symbol(c)
if x <= 0 or x == area.w - 1 then
return {}
end
return ui.Bar(
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) },
ui.Bar.TOP
):symbol(c)
end
return ya.flat {
-- Borders
ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
ui.Bar(chunks[1], ui.Bar.RIGHT),
ui.Bar(chunks[3], ui.Bar.LEFT),
ui.Bar(chunks[1]:padding(ui.Padding.y(1)), ui.Bar.RIGHT),
ui.Bar(chunks[3]:padding(ui.Padding.y(1)), ui.Bar.LEFT),
bar("", chunks[1].right - 1, chunks[1].y),
bar("", chunks[1].right - 1, chunks[1].bottom - 1),