From 6a0dc699e038be111b9bda039f43befbf49ea262 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 21 Jun 2013 20:48:17 +0300 Subject: [PATCH] Make cursor echo handle include files. --- plugin/syntastic.vim | 3 +-- plugin/syntastic/cursor.vim | 5 +++-- plugin/syntastic/loclist.vim | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ec2aa2bf..8fd41c29 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -100,8 +100,7 @@ endif function! s:BufWinEnterHook() if empty(&bt) let loclist = g:SyntasticLoclist.current() - call g:SyntasticAutoloclistNotifier.AutoToggle(loclist) - call g:SyntasticHighlightingNotifier.refresh(loclist) + call s:notifiers.refresh(loclist) endif endfunction diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 11a2e559..03024008 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -17,16 +17,17 @@ function! g:SyntasticCursorNotifier.New() endfunction 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 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 + autocmd! syntastic CursorMoved autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() endif endfunction function! g:SyntasticCursorNotifier.reset(loclist) + autocmd! syntastic CursorMoved unlet! b:syntastic_messages let b:oldLine = -1 endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 0b935621..d5cd6e39 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -92,26 +92,26 @@ function! g:SyntasticLoclist.warnings() endfunction " cache used by EchoCurrentError() -function! g:SyntasticLoclist.messages() +function! g:SyntasticLoclist.messages(buf) if !exists("self._cachedMessages") let self._cachedMessages = {} + let errors = self.errors() + (self._quietWarnings ? [] : self.warnings()) - for e in self.errors() - if !has_key(self._cachedMessages, e['lnum']) - let self._cachedMessages[e['lnum']] = e['text'] + for e in errors + let b = e['bufnr'] + 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 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 - return self._cachedMessages + return get(self._cachedMessages, a:buf, {}) endfunction "Filter the list and return new native loclist