Skip to content

Commit b9de38e

Browse files
Fix markup conflict highlight. Closes #279
1 parent 3615a42 commit b9de38e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/orgmode/colors/markup_highlighter.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ local function apply_markup_to_line(namespace, bufnr, line_index, line)
5757
if seek[char] then
5858
local next_char = chars[i + 1]
5959
if next_char == nil or vim.tbl_contains(valid_post_marker_chars, next_char) then
60-
table.insert(ranges, { type = char, from = seek[char], to = i + offset })
60+
local to = i + offset
61+
table.insert(ranges, { type = char, from = seek[char], to = to })
62+
-- Cleanup all unclosed markers in between
63+
for c, pos in pairs(seek) do
64+
if c ~= char and pos < to and pos > seek[char] then
65+
seek[c] = nil
66+
end
67+
end
6168
seek[char] = nil
6269
end
6370
else

0 commit comments

Comments
 (0)