From 2ce4b9b4b42a96d926a9f2297051cdf198ec7c55 Mon Sep 17 00:00:00 2001 From: ljie-PI Date: Sun, 8 Dec 2024 01:29:36 +0800 Subject: [PATCH 1/2] Fix get_size() function when size is a function return string --- lua/nvim-tree/view.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index 8fd07fe1c0a..21c4c6305aa 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -119,7 +119,7 @@ local function get_size(size) if type(size) == "number" then return size elseif type(size) == "function" then - return size() + return get_size(size()) end local size_as_number = tonumber(size:sub(0, -2)) local percent_as_decimal = size_as_number / 100 From 4f1c4e5506e83b1f671483a30e3430c7c239fe8f Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 8 Dec 2024 11:43:39 +1100 Subject: [PATCH 2/2] update view.width help --- doc/nvim-tree-lua.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 07985f841fd..7ab41bebff7 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -800,22 +800,22 @@ Width of the window: can be a `%` string, a number representing columns, a function or a table. A table indicates that the view should be dynamically sized based on the longest line. - Type: `string | number | table | function()` returning a number + Type: `string | number | table | fun(): number|string` Default: `30` *nvim-tree.view.width.min* Minimum dynamic width. - Type: `string | number | function()` returning a number + Type: `string | number | fun(): number|string` Default: `30` *nvim-tree.view.width.max* Maximum dynamic width, -1 for unbounded. - Type: `string | number | function()` returning a number + Type: `string | number | fun(): number|string` Default: `-1` *nvim-tree.view.width.padding* Extra padding to the right. - Type: `number | function()` returning a number + Type: `number | fun(): number|string` Default: `1` *nvim-tree.view.float*