Rename callback functions

This commit is contained in:
Marco Hinz 2017-02-20 14:52:24 +01:00
parent 0908e37758
commit 7a639b0263
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -20,8 +20,8 @@ function! sy#repo#detect(do_register) abort
endfor endfor
endfunction endfunction
" Function: s:callback_stdout_nvim {{{1 " Function: s:callback_nvim_stdout{{{1
function! s:callback_stdout_nvim(_job_id, data, _event) dict abort function! s:callback_nvim_stdout(_job_id, data, _event) dict abort
if empty(self.stdoutbuf) || empty(self.stdoutbuf[-1]) if empty(self.stdoutbuf) || empty(self.stdoutbuf[-1])
let self.stdoutbuf += a:data let self.stdoutbuf += a:data
else else
@ -31,13 +31,18 @@ function! s:callback_stdout_nvim(_job_id, data, _event) dict abort
endif endif
endfunction endfunction
" Function: s:callback_stdout_vim {{{1 " Function: s:callback_nvim_exit {{{1
function! s:callback_stdout_vim(_job_id, data) dict abort function! s:callback_nvim_exit(_job_id, exitval, _event) dict abort
call s:job_exit(self.bufnr, self.vcs, a:exitval, self.stdoutbuf, self.do_register)
endfunction
" Function: s:callback_vim_stdout {{{1
function! s:callback_vim_stdout(_job_id, data) dict abort
let self.stdoutbuf += [a:data] let self.stdoutbuf += [a:data]
endfunction endfunction
" Function: s:callback_close {{{1 " Function: s:callback_vim_close {{{1
function! s:callback_close(channel) dict abort function! s:callback_vim_close(channel) dict abort
let job = ch_getjob(a:channel) let job = ch_getjob(a:channel)
while 1 while 1
if job_status(job) == 'dead' if job_status(job) == 'dead'
@ -49,11 +54,6 @@ function! s:callback_close(channel) dict abort
call s:job_exit(self.bufnr, self.vcs, exitval, self.stdoutbuf, self.do_register) call s:job_exit(self.bufnr, self.vcs, exitval, self.stdoutbuf, self.do_register)
endfunction endfunction
" Function: s:callback_exit {{{1
function! s:callback_exit(_job_id, exitval, _event) dict abort
call s:job_exit(self.bufnr, self.vcs, a:exitval, self.stdoutbuf, self.do_register)
endfunction
" Function: s:job_exit {{{1 " Function: s:job_exit {{{1
function! s:job_exit(bufnr, vcs, exitval, diff, do_register) abort function! s:job_exit(bufnr, vcs, exitval, diff, do_register) abort
call sy#verbose('job_exit()', a:vcs) call sy#verbose('job_exit()', a:vcs)
@ -84,8 +84,8 @@ function! sy#repo#get_diff_start(vcs, do_register) abort
execute chdir fnameescape(b:sy_info.dir) execute chdir fnameescape(b:sy_info.dir)
call sy#verbose(printf('CMD: %s | CWD: %s', string(cmd), getcwd()), a:vcs) call sy#verbose(printf('CMD: %s | CWD: %s', string(cmd), getcwd()), a:vcs)
let b:sy_job_id_{a:vcs} = jobstart(cmd, extend(options, { let b:sy_job_id_{a:vcs} = jobstart(cmd, extend(options, {
\ 'on_stdout': function('s:callback_stdout_nvim'), \ 'on_stdout': function('s:callback_nvim_stdout'),
\ 'on_exit': function('s:callback_exit'), \ 'on_exit': function('s:callback_nvim_exit'),
\ })) \ }))
finally finally
execute chdir fnameescape(cwd) execute chdir fnameescape(cwd)
@ -105,8 +105,8 @@ function! sy#repo#get_diff_start(vcs, do_register) abort
call sy#verbose(printf('CMD: %s | CWD: %s', string(cmd), getcwd()), a:vcs) call sy#verbose(printf('CMD: %s | CWD: %s', string(cmd), getcwd()), a:vcs)
let opts = { let opts = {
\ 'in_io': 'null', \ 'in_io': 'null',
\ 'out_cb': function('s:callback_stdout_vim', options), \ 'out_cb': function('s:callback_vim_stdout', options),
\ 'close_cb': function('s:callback_close', options), \ 'close_cb': function('s:callback_vim_close', options),
\ } \ }
let b:sy_job_id_{a:vcs} = job_start(cmd, opts) let b:sy_job_id_{a:vcs} = job_start(cmd, opts)
finally finally