0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.1509

Problem:    Keeping both a variable for a job and the channel it refers to is
            a hassle.
Solution:   Allow passing the job where a channel is expected. (Damien)
This commit is contained in:
Bram Moolenaar
2016-03-07 21:19:38 +01:00
parent 47cff3a444
commit 151f656e17
3 changed files with 20 additions and 10 deletions

View File

@@ -10285,14 +10285,22 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
static channel_T *
get_channel_arg(typval_T *tv)
{
channel_T *channel;
channel_T *channel = NULL;
if (tv->v_type != VAR_CHANNEL)
if (tv->v_type == VAR_JOB)
{
if (tv->vval.v_job != NULL)
channel = tv->vval.v_job->jv_channel;
}
else if (tv->v_type == VAR_CHANNEL)
{
channel = tv->vval.v_channel;
}
else
{
EMSG2(_(e_invarg2), get_tv_string(tv));
return NULL;
}
channel = tv->vval.v_channel;
if (channel == NULL || !channel_is_open(channel))
{
@@ -15106,7 +15114,7 @@ f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
* "job_start()" function
*/
static void
f_job_start(typval_T *argvars UNUSED, typval_T *rettv)
f_job_start(typval_T *argvars, typval_T *rettv)
{
job_T *job;
char_u *cmd = NULL;