diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 0260b00a..70d5482e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -305,7 +305,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2 " populate loclist and jump {{{3 let do_jump = syntastic#util#var('auto_jump') + 0 if do_jump == 2 - let do_jump = loclist.getFirstError() == 1 + let do_jump = loclist.getFirstError(1) elseif do_jump == 3 let do_jump = loclist.getFirstError() elseif 0 > do_jump || do_jump > 3 diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 60049270..ced93578 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -133,8 +133,13 @@ function! g:SyntasticLoclist.getStatuslineFlag() " {{{2 return self._stl_flag endfunction " }}}2 -function! g:SyntasticLoclist.getFirstError() " {{{2 - for idx in range(len(self._rawLoclist)) +function! g:SyntasticLoclist.getFirstError(...) " {{{2 + let max_issues = len(self._rawLoclist) + if a:0 && a:1 < max_issues + let max_issues = a:1 + endif + + for idx in range(max_issues) if get(self._rawLoclist[idx], 'type', '') ==? 'E' return idx + 1 endif