Make cursor echo handle include files.

This commit is contained in:
LCD 47 2013-06-21 20:48:17 +03:00
parent ab828b14c6
commit 6a0dc699e0
3 changed files with 17 additions and 17 deletions

View File

@ -100,8 +100,7 @@ endif
function! s:BufWinEnterHook() function! s:BufWinEnterHook()
if empty(&bt) if empty(&bt)
let loclist = g:SyntasticLoclist.current() let loclist = g:SyntasticLoclist.current()
call g:SyntasticAutoloclistNotifier.AutoToggle(loclist) call s:notifiers.refresh(loclist)
call g:SyntasticHighlightingNotifier.refresh(loclist)
endif endif
endfunction endfunction

View File

@ -17,16 +17,17 @@ function! g:SyntasticCursorNotifier.New()
endfunction endfunction
function! g:SyntasticCursorNotifier.refresh(loclist) function! g:SyntasticCursorNotifier.refresh(loclist)
autocmd! syntastic CursorMoved
let enabled = exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error let enabled = exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error
if enabled && a:loclist.hasErrorsOrWarningsToDisplay() if enabled && a:loclist.hasErrorsOrWarningsToDisplay()
let b:syntastic_messages = copy(a:loclist.messages()) let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
let b:oldLine = -1 let b:oldLine = -1
autocmd! syntastic CursorMoved
autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor()
endif endif
endfunction endfunction
function! g:SyntasticCursorNotifier.reset(loclist) function! g:SyntasticCursorNotifier.reset(loclist)
autocmd! syntastic CursorMoved
unlet! b:syntastic_messages unlet! b:syntastic_messages
let b:oldLine = -1 let b:oldLine = -1
endfunction endfunction

View File

@ -92,26 +92,26 @@ function! g:SyntasticLoclist.warnings()
endfunction endfunction
" cache used by EchoCurrentError() " cache used by EchoCurrentError()
function! g:SyntasticLoclist.messages() function! g:SyntasticLoclist.messages(buf)
if !exists("self._cachedMessages") if !exists("self._cachedMessages")
let self._cachedMessages = {} let self._cachedMessages = {}
let errors = self.errors() + (self._quietWarnings ? [] : self.warnings())
for e in self.errors() for e in errors
if !has_key(self._cachedMessages, e['lnum']) let b = e['bufnr']
let self._cachedMessages[e['lnum']] = e['text'] let l = e['lnum']
if !has_key(self._cachedMessages, b)
let self._cachedMessages[b] = {}
endif
if !has_key(self._cachedMessages[b], l)
let self._cachedMessages[b][l] = e['text']
endif endif
endfor endfor
if !self._quietWarnings
for e in self.warnings()
if !has_key(self._cachedMessages, e['lnum'])
let self._cachedMessages[e['lnum']] = e['text']
endif
endfor
endif
endif endif
return self._cachedMessages return get(self._cachedMessages, a:buf, {})
endfunction endfunction
"Filter the list and return new native loclist "Filter the list and return new native loclist