Fixed TOC closest index issue

This commit is contained in:
Karl Yngve Lervåg 2014-07-15 13:41:12 +02:00
parent 32d7361621
commit 8da3c4e536

View File

@ -34,16 +34,15 @@ function! latex#toc#open()
let b:toc_numbers = 1
let b:calling_win = bufwinnr(calling_buf)
" Add TOC entries (keep track of closest index)
" Add TOC entries (and keep track of closest index)
let index = 0
let closest_index = 0
for entry in toc
call append('$', entry.number . "\t" . entry.title)
let index += 1
if closest_index == 0
if calling_file == entry.file && calling_line > entry.line
let closest_index = index
endif
if entry.file == calling_file && entry.line <= calling_line
let closest_index = index
endif
endfor