Skip to content

Commit 08277bb

Browse files
committed
fix(concealer): properly render quotes
1 parent 32803ba commit 08277bb

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

lua/neorg/modules/core/concealer/module.lua

+28-18
Original file line numberDiff line numberDiff line change
@@ -495,22 +495,32 @@ module.public = {
495495
end
496496
end,
497497

498-
multilevel_copied = function(config, bufid, node)
498+
---@param node TSNode
499+
quote_concealed = function(config, bufid, node)
499500
if not config.icons then
500501
return
501502
end
502-
local row_0b, col_0b, len = get_node_position_and_text_length(bufid, node)
503+
504+
local lines_count_0b = vim.api.nvim_buf_line_count(bufid) - 1
505+
506+
local prefix = node:named_child(0)
507+
508+
local row_0b, col_0b, len = get_node_position_and_text_length(bufid, prefix)
509+
local row_last_0b = node:end_()
510+
503511
local last_icon, last_highlight
504-
for i = 1, len do
505-
if config.icons[i] ~= nil then
506-
last_icon = config.icons[i]
507-
end
508-
if not last_icon then
509-
goto continue
512+
for line=row_0b, row_last_0b > lines_count_0b and lines_count_0b or row_last_0b do
513+
for col = 1, len do
514+
if config.icons[col] ~= nil then
515+
last_icon = config.icons[col]
516+
end
517+
if not last_icon then
518+
goto continue
519+
end
520+
last_highlight = config.highlights[col] or last_highlight
521+
set_mark(bufid, line, col_0b + (col - 1), last_icon, last_highlight)
522+
::continue::
510523
end
511-
last_highlight = config.highlights[i] or last_highlight
512-
set_mark(bufid, row_0b, col_0b + (i - 1), last_icon, last_highlight)
513-
::continue::
514524
end
515525
end,
516526

@@ -730,12 +740,12 @@ module.config.public = {
730740
quote = {
731741
icons = { "" },
732742
nodes = {
733-
"quote1_prefix",
734-
"quote2_prefix",
735-
"quote3_prefix",
736-
"quote4_prefix",
737-
"quote5_prefix",
738-
"quote6_prefix",
743+
"quote1",
744+
"quote2",
745+
"quote3",
746+
"quote4",
747+
"quote5",
748+
"quote6",
739749
},
740750
highlights = {
741751
"@neorg.quotes.1.prefix",
@@ -745,7 +755,7 @@ module.config.public = {
745755
"@neorg.quotes.5.prefix",
746756
"@neorg.quotes.6.prefix",
747757
},
748-
render = module.public.icon_renderers.multilevel_copied,
758+
render = module.public.icon_renderers.quote_concealed,
749759
},
750760
heading = {
751761
icons = { "", "", "", "", "", "" },

0 commit comments

Comments
 (0)