From dbad1dbee743844fa4f4ba59c6193e935c3e6e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Thu, 4 Aug 2016 23:02:36 +0200 Subject: [PATCH] Fixed #508 --- autoload/vimtex/toc.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/vimtex/toc.vim b/autoload/vimtex/toc.vim index c3ae513..54b8d4e 100644 --- a/autoload/vimtex/toc.vim +++ b/autoload/vimtex/toc.vim @@ -195,7 +195,7 @@ function! vimtex#toc#get_entries() " {{{1 let l:toc = [] let l:included = { - \ 'toc_len_prev' : 0, + \ 'toc_length' : 0, \ 'prev' : l:parsed[0][0], \ 'files' : [l:parsed[0][0]], \ 'current' : { 'entries' : 0 }, @@ -208,8 +208,8 @@ function! vimtex#toc#get_entries() " {{{1 " not necessaries. In other words, we only want to keep TOC entries " for included files that do not have other TOC entries inside them. if l:file ==# l:included.prev - if l:included.toc_len_prev < len(l:toc) - let l:included.toc_len_prev += 1 + if l:included.toc_length < len(l:toc) + let l:included.toc_length = len(l:toc) let l:included.current.entries += 1 endif else @@ -222,9 +222,11 @@ function! vimtex#toc#get_entries() " {{{1 \ 'file' : l:file, \ 'line' : 1, \ 'level' : s:number.current_level, - \ 'entries' : 1, + \ 'entries' : 0, \ } call add(l:toc, l:included.current) + else + let l:included.current = { 'entries' : 0 } endif endif