mirror of
https://github.com/gryf/tagbar.git
synced 2026-10-06 13:40:36 +02:00
Short-circuit parent searches if tag doesn't have line number
This commit is contained in:
1 parent
41ee79fc0f
commit
b1c6cbc2d8
1 file changed
+8
@@ -2672,6 +2672,14 @@ function! s:add_tag_recursive(parent, taginfo, pathlist) abort
|
||||
" Start at line 0 so that pseudotags get included
|
||||
let minline = 0
|
||||
for candidate in parents
|
||||
" If the line number of the current tag is 0 then we have no way
|
||||
" of determining the best candidate by comparing line numbers.
|
||||
" Just use the first one we have.
|
||||
if a:taginfo.fields.line == 0
|
||||
let parent = candidate
|
||||
break
|
||||
endif
|
||||
|
||||
if candidate.fields.line <= a:taginfo.fields.line &&
|
||||
\ candidate.fields.line >= minline
|
||||
let parent = candidate
|
||||
|
||||
Reference in new issue
Block a user