From 06e5fe1c7a2a4009c483b28b298700590e7b6784 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov <113844030+dangooddd@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:43:53 +0600 Subject: [PATCH] feat: add method to configure roundess of borders (#11) Co-authored-by: sxyazi --- full-border.yazi/README.md | 10 ++++++++-- full-border.yazi/init.lua | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/full-border.yazi/README.md b/full-border.yazi/README.md index 05e8386..b1c9a52 100644 --- a/full-border.yazi/README.md +++ b/full-border.yazi/README.md @@ -18,5 +18,11 @@ Add this to your `init.lua` to enable the plugin: require("full-border"):setup() ``` -This plugin overrides the [`Manager.render`](https://github.com/sxyazi/yazi/blob/latest/yazi-plugin/preset/components/manager.lua) method, -you might need to check if any other plugins that also need to override it are enabled. +Or you can customize the border type: + +```lua +require("full-border"):setup { + -- Available values: ui.Border.PLAIN, ui.Border.ROUNDED + type = ui.Border.PLAIN, +} +``` diff --git a/full-border.yazi/init.lua b/full-border.yazi/init.lua index 06b13e5..fcd0cbe 100644 --- a/full-border.yazi/init.lua +++ b/full-border.yazi/init.lua @@ -1,5 +1,7 @@ -local function setup() +local function setup(_, opts) + local type = opts and opts.type or ui.Border.ROUNDED local old_build = Tab.build + Tab.build = function(self, ...) local bar = function(c, x, y) if x <= 0 or x == self._area.w - 1 then @@ -21,7 +23,7 @@ local function setup() local style = THEME.manager.border_style self._base = ya.list_merge(self._base or {}, { - ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style), + ui.Border(self._area, ui.Border.ALL):type(type):style(style), ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style), ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style),