From cc8f47e248a929c182c696e16f326043eadd1a5e Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 2 May 2019 07:57:10 +0200 Subject: [PATCH] async: fix small problems with dirty jobs --- autoload/airline/async.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoload/airline/async.vim b/autoload/airline/async.vim index 5ce0233..f1be3d5 100644 --- a/autoload/airline/async.vim +++ b/autoload/airline/async.vim @@ -73,12 +73,19 @@ function! s:set_clean_variables(file, vcs) endif endfunction +function! s:set_clean_jobs_variable(vcs, file, id) + if !has_key(s:clean_jobs, a:vcs) + let s:clean_jobs[a:vcs] = {} + endif + let s:clean_jobs[a:vcs][a:file]=a:id +endfunction + function! s:on_exit_clean(...) dict abort let buf=self.buf if !empty(buf) call s:set_clean_variables(self.file, self.vcs) endif - if has_key(get(s:clean_jobs, 'self.vcs', {}), self.file) + if has_key(get(s:clean_jobs, self.vcs, {}), self.file) call remove(s:clean_jobs[self.vcs], self.file) endif endfunction @@ -186,7 +193,7 @@ if v:version >= 800 && has("job") \ 'err_io': 'null', \ 'out_cb': function('s:on_stdout', options), \ 'close_cb': function('s:on_exit_clean', options)}) - let jobs[a:file] = id + call s:set_clean_jobs_variable(a:vcs, a:file, id) endfunction function! airline#async#vim_vcs_untracked(config, file) @@ -309,7 +316,7 @@ elseif has("nvim") call remove(s:clean_jobs[a:vcs], a:file) endif let id = jobstart(cmd, config) - let s:clean_jobs[a:vcs][a:file] = id + call s:set_clean_jobs_variable(a:vcs, a:file, id) endfunction endif