Mercurial > vim
diff src/channel.c @ 12056:0498547dace0 v8.0.0908
patch 8.0.0908: cannot set terminal size with options
commit https://github.com/vim/vim/commit/08d384ff3aa0366c18fb87ed215b1b4bdf9b1745
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 11 21:51:23 2017 +0200
patch 8.0.0908: cannot set terminal size with options
Problem: Cannot set terminal size with options.
Solution: Add "term_rows", "term_cols" and "vertical".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 11 Aug 2017 22:00:05 +0200 |
parents | 2796a2c9fc17 |
children | e78fde22faec |
line wrap: on
line diff
--- 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, t 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 * #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 * } 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->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 * } 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 *o 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; }