-
-
Notifications
You must be signed in to change notification settings - Fork 629
Closed
Labels
PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatednvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't workingSomething isn't working
Description
Is your feature request related to a problem? Please describe.
I like the nvim-tree window to take as much width as needed as long as it doesn't cover over 60%
of the screen. For this reason, I'm using
view.width = {
min = -1,
max=60%
}
This works very nice, but when used together with right_align
ed icon extmarks, the longest paths are not always shown in full, even if there is plenty of width in the window. This is likely because the max width computation doesn't take these extmarks into account.
It would be great to have the width computation take extmarks into account.
I guess the modification could be done here?
nvim-tree.lua/lua/nvim-tree/view.lua
Lines 302 to 335 in ca7c4c3
local function grow() | |
local starts_at = M.is_root_folder_visible(require("nvim-tree.core").get_cwd()) and 1 or 0 | |
local lines = vim.api.nvim_buf_get_lines(M.get_bufnr(), starts_at, -1, false) | |
-- number of columns of right-padding to indicate end of path | |
local padding = get_size(M.View.padding) | |
-- account for sign/number columns etc. | |
local wininfo = vim.fn.getwininfo(M.get_winnr()) | |
if type(wininfo) == "table" and type(wininfo[1]) == "table" then | |
padding = padding + wininfo[1].textoff | |
end | |
local resizing_width = M.View.initial_width - padding | |
local max_width | |
-- maybe bound max | |
if M.View.max_width == -1 then | |
max_width = -1 | |
else | |
max_width = get_width(M.View.max_width) - padding | |
end | |
for _, l in pairs(lines) do | |
local count = vim.fn.strchars(l) | |
if resizing_width < count then | |
resizing_width = count | |
end | |
if M.View.adaptive_size and max_width >= 0 and resizing_width >= max_width then | |
resizing_width = max_width | |
break | |
end | |
end | |
M.resize(resizing_width + padding) | |
end |
Metadata
Metadata
Assignees
Labels
PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatednvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedbugSomething isn't workingSomething isn't working