Skip to content

Commit

Permalink
Merge pull request #14 from milksys/not-text-cursormoved
Browse files Browse the repository at this point in the history
Fix: byte text, cursormoved error
  • Loading branch information
m4xshen authored Sep 2, 2023
2 parents 4aa00ad + 7bd83ff commit d01b993
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/smartcolumn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ local function exceed(buf, win, min_colorcolumn)
end

local max_column = 0

for _, line in pairs(lines) do
max_column = math.max(max_column, vim.fn.strdisplaywidth(line))
local success, column_number = pcall(vim.fn.strdisplaywidth, line)

if not success then
return false
end

max_column = math.max(max_column, column_number)
end

return not vim.tbl_contains(config.disabled_filetypes, vim.bo.ft) and max_column > min_colorcolumn
Expand Down

0 comments on commit d01b993

Please sign in to comment.