feat: add method to configure roundess of borders (#11)

Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
Dmitry Nefedov
2024-07-18 11:43:53 +06:00
committed by GitHub
parent 0dc9dcd579
commit 06e5fe1c7a
2 changed files with 12 additions and 4 deletions

View File

@@ -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,
}
```

View File

@@ -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),