From f4b6c80aef101e42b3e726793cb7e81d74971a5f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 11 Sep 2016 13:22:15 +0300 Subject: [PATCH] Bug fix: more auto_loc_list fixes. --- plugin/syntastic.vim | 10 +--------- plugin/syntastic/autoloclist.vim | 24 ++++++++++++++++++++---- plugin/syntastic/loclist.vim | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b0cc68c3..a62966ee 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-221' +let g:_SYNTASTIC_VERSION = '3.7.0-222' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -233,14 +233,6 @@ endfunction " }}}2 function! SyntasticReset() abort " {{{2 call s:ClearCache(bufnr('')) call s:notifiers.refresh(g:SyntasticLoclist.New([])) - if !empty(get(w:, 'syntastic_loclist_set', [])) - try - " Vim 7.4.2200 or later - call setloclist(0, [], 'r', { 'title': '' }) - catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/ - " do nothing - endtry - endif endfunction " }}}2 function! SyntasticToggleMode() abort " {{{2 diff --git a/plugin/syntastic/autoloclist.vim b/plugin/syntastic/autoloclist.vim index 9639b2b8..415d5ab9 100644 --- a/plugin/syntastic/autoloclist.vim +++ b/plugin/syntastic/autoloclist.vim @@ -26,10 +26,26 @@ function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2 endif else if (auto_loc_list == 1 || auto_loc_list == 2) && !empty(get(w:, 'syntastic_loclist_set', [])) - "TODO: this will close the loc list window if one was opened by - "something other than syntastic - call SyntasticLoclistHide() - let w:syntastic_loclist_set = [] + try + " Vim 7.4.2200 or later + let title = get(getloclist(0, { 'title': 1 }), 'title', ':SyntasticCheck ') + catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/ + let title = ':SyntasticCheck ' + endtry + + if strpart(title, 0, 16) ==# ':SyntasticCheck ' + " TODO: this will close the loc list window if one was opened + " by something other than syntastic + call SyntasticLoclistHide() + + try + " Vim 7.4.2200 or later + call setloclist(0, [], 'r', { 'title': '' }) + catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/ + " do nothing + endtry + let w:syntastic_loclist_set = [] + endif endif endif endfunction " }}}2 diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 923bb54d..d4a20b98 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -299,7 +299,7 @@ function! g:SyntasticLoclist.setloclist(new) abort " {{{2 call setloclist(0, self.getRaw(), replace ? 'r' : ' ') try " Vim 7.4.2200 or later - call setloclist(0, [], 'r', { 'title': (self.isEmpty() ? '' : ':SyntasticCheck ' . self._name) }) + call setloclist(0, [], 'r', { 'title': ':SyntasticCheck ' . self._name }) catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/ " do nothing endtry