Skip to content

Commit 041ff8a

Browse files
authored
fix(virtual indent): make TS lookup not exclude lines (#700)
Prior to this commit, it was possible that virtual indents would only apply to the first heading in a range of lines and the other headings would lose virtual indentation. This change makes the Treesitter lookup prefer the largest range of lines to set virtual indentation on and thus ensures virtual indent is set correctly across the entire range.
1 parent 872853d commit 041ff8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/orgmode/ui/virtual_indent.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ function VirtualIndent:set_indent(start_line, end_line, ignore_ts)
8484
if headline and not ignore_ts then
8585
local parent = headline:parent()
8686
if parent then
87-
start_line = parent:start()
88-
end_line = parent:end_()
87+
start_line = math.min(parent:start(), start_line)
88+
end_line = math.max(parent:end_(), end_line)
8989
end
9090
end
9191
if start_line > 0 then

0 commit comments

Comments
 (0)