diff options
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/channel.c b/src/channel.c index 3126cbd78f..b220f7166b 100644 --- a/src/channel.c +++ b/src/channel.c @@ -927,7 +927,7 @@ channel_open_func(typval_T *argvars) opt.jo_mode = MODE_JSON; opt.jo_timeout = 2000; if (get_job_options(&argvars[1], &opt, - JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL) == FAIL) + JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL, 0) == FAIL) goto theend; if (opt.jo_timeout < 0) { @@ -3429,7 +3429,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw) rettv->vval.v_string = NULL; clear_job_options(&opt); - if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID) + if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID, 0) == FAIL) goto theend; @@ -3612,7 +3612,7 @@ send_common( part_send = channel_part_send(channel); *part_read = channel_part_read(channel); - if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT) == FAIL) + if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT, 0) == FAIL) return NULL; /* Set the callback. An empty callback means no callback and not reading @@ -4169,11 +4169,11 @@ part_from_char(int c) /* * Get the option entries from the dict in "tv", parse them and put the result * in "opt". - * Only accept options in "supported". + * Only accept JO_ options in "supported" and JO2_ options in "supported2". * If an option value is invalid return FAIL. */ int -get_job_options(typval_T *tv, jobopt_T *opt, int supported) +get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { typval_T *item; char_u *val; @@ -4411,7 +4411,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported) #ifdef FEAT_TERMINAL else if (STRCMP(hi->hi_key, "term_name") == 0) { - if (!(supported & JO2_TERM_NAME)) + if (!(supported2 & JO2_TERM_NAME)) break; opt->jo_set2 |= JO2_TERM_NAME; opt->jo_term_name = get_tv_string_chk(item); @@ -4423,7 +4423,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported) } else if (STRCMP(hi->hi_key, "term_finish") == 0) { - if (!(supported & JO2_TERM_FINISH)) + if (!(supported2 & JO2_TERM_FINISH)) break; val = get_tv_string(item); if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) @@ -4434,10 +4434,31 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported) opt->jo_set2 |= JO2_TERM_FINISH; opt->jo_term_finish = *val; } + else if (STRCMP(hi->hi_key, "term_rows") == 0) + { + if (!(supported2 & JO2_TERM_ROWS)) + break; + opt->jo_set |= JO2_TERM_ROWS; + opt->jo_term_rows = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "term_cols") == 0) + { + if (!(supported2 & JO2_TERM_COLS)) + break; + opt->jo_set |= JO2_TERM_COLS; + opt->jo_term_cols = get_tv_number(item); + } + else if (STRCMP(hi->hi_key, "vertical") == 0) + { + if (!(supported2 & JO2_VERTICAL)) + break; + opt->jo_set |= JO2_VERTICAL; + opt->jo_vertical = get_tv_number(item); + } #endif else if (STRCMP(hi->hi_key, "env") == 0) { - if (!(supported & JO2_ENV)) + if (!(supported2 & JO2_ENV)) break; opt->jo_set |= JO2_ENV; opt->jo_env = item->vval.v_dict; @@ -4445,7 +4466,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported) } else if (STRCMP(hi->hi_key, "cwd") == 0) { - if (!(supported & JO2_CWD)) + if (!(supported2 & JO2_CWD)) break; opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)) @@ -4956,7 +4977,7 @@ job_start(typval_T *argvars, jobopt_T *opt_arg) opt.jo_mode = MODE_NL; if (get_job_options(&argvars[1], &opt, JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT - + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL) + + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE, 0) == FAIL) goto theend; } |