fix: count unicode codepoints instead of bytes (#1445)

This commit is contained in:
FotiadisM
2022-07-21 00:05:44 +03:00
committed by GitHub
parent 630305c233
commit 1e3c578eeb

View File

@@ -211,8 +211,9 @@ local function grow()
local lines = vim.api.nvim_buf_get_lines(M.get_bufnr(), starts_at, -1, false)
local max_length = M.View.initial_width
for _, l in pairs(lines) do
if max_length < #l then
max_length = #l
local count = vim.fn.strchars(l) + 3 -- plus some padding
if max_length < count then
max_length = count
end
end
M.resize(max_length)