diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-30 12:03:06 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-30 12:03:06 +0200 |
commit | e9d8c396089c56d39ae374f29d3a6f45b63420fc (patch) | |
tree | effecc4b183dcd14056d0bfb9c6d908cc7c8eb84 /ftplugin | |
parent | 04e6a8a73cce5f4b78671e87aba19ce9abb52ac4 (diff) | |
download | vim-polyglot-e9d8c396089c56d39ae374f29d3a6f45b63420fc.tar.gz vim-polyglot-e9d8c396089c56d39ae374f29d3a6f45b63420fc.zip |
Update coffee, html and latex
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/latex-box/motion.vim | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim index fea4e5f2..72481753 100644 --- a/ftplugin/latex-box/motion.vim +++ b/ftplugin/latex-box/motion.vim @@ -312,7 +312,7 @@ function! s:ReadTOC(auxfile, texfile, ...) if included != '' " append the input TOX to `toc` and `fileindices` let newaux = prefix . '/' . included - let newtex = fnamemodify(fnamemodify(newaux, ':t:r') . '.tex', ':p') + let newtex = fnamemodify(newaux, ':r') . '.tex' call s:ReadTOC(newaux, newtex, toc, fileindices) continue endif @@ -441,23 +441,26 @@ function! s:FindClosestSection(toc, fileindices) endif let imax = len(a:fileindices[file]) - let imin = 0 - while imin < imax - 1 - let i = (imax + imin) / 2 - let tocindex = a:fileindices[file][i] - let entry = a:toc[tocindex] - let titlestr = entry['text'] - let titlestr = escape(titlestr, '\') - let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g') - let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW') - if lnum - let imax = i - else - let imin = i - endif - endwhile - - return a:fileindices[file][imin] + if imax > 0 + let imin = 0 + while imin < imax - 1 + let i = (imax + imin) / 2 + let tocindex = a:fileindices[file][i] + let entry = a:toc[tocindex] + let titlestr = entry['text'] + let titlestr = escape(titlestr, '\') + let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g') + let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW') + if lnum + let imax = i + else + let imin = i + endif + endwhile + return a:fileindices[file][imin] + else + return 0 + endif endfunction let s:ConvBackPats = map([ |