Skip to content

Commit

Permalink
fix: ensure globpath_upwards only returns files
Browse files Browse the repository at this point in the history
refer: #2763
  • Loading branch information
lervag committed Jul 24, 2023
1 parent 53464eb commit 9da5481
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autoload/vimtex/state.vim
Original file line number Diff line number Diff line change
Expand Up @@ -542,15 +542,17 @@ endfunction

" }}}1
function! s:globpath_upwards(expr, path) abort " {{{1
" Returns the list of files obtained by globpath(p, a:expr) with p going from
" a:path and upwards in the directory tree.
" Returns the list of files (NOT directories) obtained by globpath(p, a:expr)
" with p going from a:path and upwards in the directory tree.
let l:path = a:path
let l:dirs = l:path
while l:path != fnamemodify(l:path, ':h')
let l:path = fnamemodify(l:path, ':h')
let l:dirs .= ',' . l:path
endwhile
return split(globpath(fnameescape(l:dirs), a:expr), '\n')
return filter(
\ split(globpath(fnameescape(l:dirs), a:expr), '\n'),
\ 'filereadable(v:val)')
endfunction

" }}}1
Expand Down

0 comments on commit 9da5481

Please sign in to comment.