Skip to content

Commit

Permalink
ensure fmt list gets closed when title cannot be checked
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Sep 24, 2017
1 parent 458d230 commit 0d72ef5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions autoload/go/fmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,19 @@ function! go#fmt#update_file(source, target)

" the title information was introduced with 7.4-2200
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if !has('patch-7.4-2200')
return
endif

" clean up previous list
let l:listtype = go#list#Type("GoFmt")
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
if has('patch-7.4-2200')
" clean up previous list
let l:listtype = go#list#Type("GoFmt")
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
let l:list_title = getloclist(0, {'title': 1})
endif
else
let l:list_title = getloclist(0, {'title': 1})
" can't check the title, so assume that the list was for go fmt.
let l:list_title = {'title': 'Format'}
endif

if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
call go#list#Clean(l:listtype)
call go#list#Window(l:listtype)
Expand Down

0 comments on commit 0d72ef5

Please sign in to comment.