File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ M.fetch_symbols_sync = function(bufnr)
2323 local idx , len = string.find (line , " ^#+ " )
2424 if idx == 1 and not inside_code_block then
2525 local level = len - 2
26- local parent = stack [math.min (level , # stack )]
26+ while # stack > 0 and stack [# stack ].level >= level do
27+ table.remove (stack , # stack )
28+ end
29+ local parent = stack [# stack ]
2730 local item = {
2831 kind = " Interface" ,
2932 name = string.sub (line , len + 1 ),
@@ -49,9 +52,6 @@ M.fetch_symbols_sync = function(bufnr)
4952 table.insert (items , item )
5053 end
5154 end
52- while # stack > level and # stack > 0 do
53- table.remove (stack , # stack )
54- end
5555 table.insert (stack , item )
5656 elseif string.find (line , " ```" ) == 1 then
5757 inside_code_block = not inside_code_block
Original file line number Diff line number Diff line change 109109
110110--- @param item aerial.Symbol
111111--- @return nil | aerial.Symbol
112- function BufData : _next_non_collapsed (item )
112+ local function _next_non_collapsed (item )
113113 while item do
114114 if item .next_sibling then
115115 return item .next_sibling
@@ -133,7 +133,7 @@ function BufData:iter(opts)
133133 --- @type nil | aerial.Symbol
134134 local item = self .flat_items [i ]
135135 if opts .skip_hidden and item and self :is_collapsed (item .parent ) then
136- item = self : _next_non_collapsed (item .parent )
136+ item = _next_non_collapsed (item .parent )
137137 end
138138 if item then
139139 return item .idx , item , j
You can’t perform that action at this time.
0 commit comments