Skip to content

Commit

Permalink
docs: add more bounds checking to the full border
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Nov 16, 2023
1 parent ba50925 commit 6a81070
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ You can implement a full border for Yazi via the UI plugin.
Copy the preset [`Manager:render` function](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/components/manager.lua) to any place, for example `~/.config/yazi/ui.lua`, then apply the following patch:

```diff
@@ -10,16 +10,26 @@ function Manager:render(area)
@@ -10,16 +10,28 @@ function Manager:render(area)
})
:split(area)

+ local bar = function(c, x, y)
+ return ui.Bar(ui.Rect { x = math.max(0, x), y = math.max(0, y), w = 1, h = 1 }, ui.Position.TOP):symbol(c)
+ return ui.Bar(
+ ui.Rect { x = math.max(0, x), y = math.max(0, y), w = math.min(1, area.w), h = math.min(1, area.h) },
+ ui.Position.TOP
+ ):symbol(c)
+ end
+
return utils.flat {
Expand Down

0 comments on commit 6a81070

Please sign in to comment.