Fix #584 - Fix Neovim line handling issues

This commit is contained in:
w0rp 2017-05-27 19:23:13 +01:00
parent 5825a65627
commit 8e997ac231
1 changed files with 16 additions and 8 deletions

View File

@ -42,25 +42,33 @@ function! ale#job#JoinNeovimOutput(job, last_line, data, callback) abort
endfunction endfunction
function! s:NeoVimCallback(job, data, event) abort function! s:NeoVimCallback(job, data, event) abort
let l:job_info = s:job_map[a:job] let l:info = s:job_map[a:job]
if a:event ==# 'stdout' if a:event ==# 'stdout'
let l:job_info.out_cb_line = ale#job#JoinNeovimOutput( let l:info.out_cb_line = ale#job#JoinNeovimOutput(
\ a:job, \ a:job,
\ l:job_info.out_cb_line, \ l:info.out_cb_line,
\ a:data, \ a:data,
\ ale#util#GetFunction(l:job_info.out_cb), \ ale#util#GetFunction(l:info.out_cb),
\) \)
elseif a:event ==# 'stderr' elseif a:event ==# 'stderr'
let l:job_info.err_cb_line = ale#job#JoinNeovimOutput( let l:info.err_cb_line = ale#job#JoinNeovimOutput(
\ a:job, \ a:job,
\ l:job_info.err_cb_line, \ l:info.err_cb_line,
\ a:data, \ a:data,
\ ale#util#GetFunction(l:job_info.err_cb), \ ale#util#GetFunction(l:info.err_cb),
\) \)
else else
if has_key(l:info, 'out_cb') && !empty(l:info.out_cb_line)
call ale#util#GetFunction(l:info.out_cb)(a:job, l:info.out_cb_line)
endif
if has_key(l:info, 'err_cb') && !empty(l:info.err_cb_line)
call ale#util#GetFunction(l:info.err_cb)(a:job, l:info.err_cb_line)
endif
try try
call ale#util#GetFunction(l:job_info.exit_cb)(a:job, a:data) call ale#util#GetFunction(l:info.exit_cb)(a:job, a:data)
finally finally
" Automatically forget about the job after it's done. " Automatically forget about the job after it's done.
if has_key(s:job_map, a:job) if has_key(s:job_map, a:job)