1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

Short-circuit parent searches if tag doesn't have line number

This commit is contained in:
Jan Larres
2017-06-15 17:27:30 +12:00
parent 41ee79fc0f
commit b1c6cbc2d8

View File

@@ -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