Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use strwidth instead of strdisplaywidth #903

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/ibl/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ M.default_config = {
---@return boolean, string?
local validate_char = function(char)
if type(char) == "string" then
local length = vim.fn.strdisplaywidth(char)
local length = vim.fn.strwidth(char)
return length <= 1, string.format("'%s' has a display width of %d", char, length)
else
if #char == 0 then
return false, "table is empty"
end
for i, c in ipairs(char) do
local length = vim.fn.strdisplaywidth(c)
local length = vim.fn.strwidth(c)
if length > 1 then
return false, string.format("index %d '%s' has a display width of %d", i, c, length)
end
Expand Down
4 changes: 2 additions & 2 deletions lua/ibl/virt_text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ M.get = function(

if indent.is_indent(ws) then
whitespace_hl = utils.tbl_get_index(highlights.whitespace, indent_index).char
if vim.fn.strdisplaywidth(char) == 0 then
if vim.fn.strwidth(char) == 0 then
char = char_map[whitespace.SPACE] --[[@as string]]
sa = false
else
Expand All @@ -108,7 +108,7 @@ M.get = function(

if config.scope.char then
local scope_char = get_char(config.scope.char, scope_index)
if vim.fn.strdisplaywidth(scope_char) == 1 then
if vim.fn.strwidth(scope_char) == 1 then
char = scope_char
end
end
Expand Down
Loading