Mercurial > vim
diff src/evalfunc.c @ 13740:f309afff6f25 v8.0.1742
patch 8.0.1742: cannot get a list of all the jobs
commit https://github.com/vim/vim/commit/e1fc51558dc14906a8d9f6a6e7bb1ac2a6ba8f3d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 21 19:49:08 2018 +0200
patch 8.0.1742: cannot get a list of all the jobs
Problem: Cannot get a list of all the jobs. Cannot get the command of
the job.
Solution: When job_info() is called without an argument return a list of
jobs. Otherwise, include the command that the job is running.
(Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Apr 2018 20:00:07 +0200 |
parents | 39fcaaa973db |
children | 9de2b25932eb |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -682,7 +682,7 @@ static struct fst {"items", 1, 1, f_items}, #ifdef FEAT_JOB_CHANNEL {"job_getchannel", 1, 1, f_job_getchannel}, - {"job_info", 1, 1, f_job_info}, + {"job_info", 0, 1, f_job_info}, {"job_setoptions", 2, 2, f_job_setoptions}, {"job_start", 1, 2, f_job_start}, {"job_status", 1, 1, f_job_status}, @@ -7007,10 +7007,15 @@ f_job_getchannel(typval_T *argvars, typv static void f_job_info(typval_T *argvars, typval_T *rettv) { - job_T *job = get_job_arg(&argvars[0]); - - if (job != NULL && rettv_dict_alloc(rettv) != FAIL) - job_info(job, rettv->vval.v_dict); + if (argvars[0].v_type != VAR_UNKNOWN) + { + job_T *job = get_job_arg(&argvars[0]); + + if (job != NULL && rettv_dict_alloc(rettv) != FAIL) + job_info(job, rettv->vval.v_dict); + } + else if (rettv_list_alloc(rettv) == OK) + job_info_all(rettv->vval.v_list); } /*