Skip to content

Commit

Permalink
Use unicode-aware substring when deriving foldtext
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Jakusev authored and vhyrro committed Mar 24, 2024
1 parent e8d8d1e commit 4e5a3f1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lua/neorg/modules/core/concealer/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,11 @@ module.public = {

for _, extmark in ipairs(icon_extmarks) do
local extmark_details = extmark[4]
local extmark_column = extmark[3] + (line_length - vim.api.nvim_strwidth(line))

for _, virt_text in ipairs(extmark_details.virt_text or {}) do
line = line:sub(1, extmark_column)
line = vim.fn.strcharpart( line, 0, extmark[3] )
.. virt_text[1]
.. line:sub(extmark_column + vim.api.nvim_strwidth(virt_text[1]) + 1)
line_length = vim.api.nvim_strwidth(line) - line_length + vim.api.nvim_strwidth(virt_text[1])
.. vim.fn.strcharpart( line, extmark[3] + vim.api.nvim_strwidth(virt_text[1]) )
end
end

Expand Down

0 comments on commit 4e5a3f1

Please sign in to comment.