Skip to content

Commit

Permalink
fix(concealer): properly render quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Jul 23, 2024
1 parent 32803ba commit 08277bb
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions lua/neorg/modules/core/concealer/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -495,22 +495,32 @@ module.public = {
end
end,

multilevel_copied = function(config, bufid, node)
---@param node TSNode
quote_concealed = function(config, bufid, node)
if not config.icons then
return
end
local row_0b, col_0b, len = get_node_position_and_text_length(bufid, node)

local lines_count_0b = vim.api.nvim_buf_line_count(bufid) - 1

local prefix = node:named_child(0)

local row_0b, col_0b, len = get_node_position_and_text_length(bufid, prefix)
local row_last_0b = node:end_()

local last_icon, last_highlight
for i = 1, len do
if config.icons[i] ~= nil then
last_icon = config.icons[i]
end
if not last_icon then
goto continue
for line=row_0b, row_last_0b > lines_count_0b and lines_count_0b or row_last_0b do
for col = 1, len do
if config.icons[col] ~= nil then
last_icon = config.icons[col]
end
if not last_icon then
goto continue
end
last_highlight = config.highlights[col] or last_highlight
set_mark(bufid, line, col_0b + (col - 1), last_icon, last_highlight)
::continue::
end
last_highlight = config.highlights[i] or last_highlight
set_mark(bufid, row_0b, col_0b + (i - 1), last_icon, last_highlight)
::continue::
end
end,

Expand Down Expand Up @@ -730,12 +740,12 @@ module.config.public = {
quote = {
icons = { "" },
nodes = {
"quote1_prefix",
"quote2_prefix",
"quote3_prefix",
"quote4_prefix",
"quote5_prefix",
"quote6_prefix",
"quote1",
"quote2",
"quote3",
"quote4",
"quote5",
"quote6",
},
highlights = {
"@neorg.quotes.1.prefix",
Expand All @@ -745,7 +755,7 @@ module.config.public = {
"@neorg.quotes.5.prefix",
"@neorg.quotes.6.prefix",
},
render = module.public.icon_renderers.multilevel_copied,
render = module.public.icon_renderers.quote_concealed,
},
heading = {
icons = { "", "", "", "", "", "" },
Expand Down

0 comments on commit 08277bb

Please sign in to comment.