Bug fix: more auto_loc_list fixes.

This commit is contained in:
LCD 47 2016-09-11 13:22:15 +03:00
parent 8ab26a2268
commit f4b6c80aef
3 changed files with 22 additions and 14 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.7.0-221' let g:_SYNTASTIC_VERSION = '3.7.0-222'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1
@ -233,14 +233,6 @@ endfunction " }}}2
function! SyntasticReset() abort " {{{2 function! SyntasticReset() abort " {{{2
call s:ClearCache(bufnr('')) call s:ClearCache(bufnr(''))
call s:notifiers.refresh(g:SyntasticLoclist.New([])) 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 endfunction " }}}2
function! SyntasticToggleMode() abort " {{{2 function! SyntasticToggleMode() abort " {{{2

View File

@ -26,12 +26,28 @@ function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
endif endif
else else
if (auto_loc_list == 1 || auto_loc_list == 2) && !empty(get(w:, 'syntastic_loclist_set', [])) 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 try
"something other than syntastic " 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() 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 = [] let w:syntastic_loclist_set = []
endif endif
endif endif
endif
endfunction " }}}2 endfunction " }}}2
" }}}1 " }}}1

View File

@ -299,7 +299,7 @@ function! g:SyntasticLoclist.setloclist(new) abort " {{{2
call setloclist(0, self.getRaw(), replace ? 'r' : ' ') call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
try try
" Vim 7.4.2200 or later " 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\)/ catch /\m^Vim\%((\a\+)\)\=:E\%(118\|731\)/
" do nothing " do nothing
endtry endtry