Skip to content

Commit 1e3c578

Browse files
authored
fix: count unicode codepoints instead of bytes (#1445)
1 parent 630305c commit 1e3c578

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lua/nvim-tree/view.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ local function grow()
211211
local lines = vim.api.nvim_buf_get_lines(M.get_bufnr(), starts_at, -1, false)
212212
local max_length = M.View.initial_width
213213
for _, l in pairs(lines) do
214-
if max_length < #l then
215-
max_length = #l
214+
local count = vim.fn.strchars(l) + 3 -- plus some padding
215+
if max_length < count then
216+
max_length = count
216217
end
217218
end
218219
M.resize(max_length)

0 commit comments

Comments
 (0)