Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
12055:8dce424b095b | 12056:0498547dace0 |
---|---|
925 /* parse options */ | 925 /* parse options */ |
926 clear_job_options(&opt); | 926 clear_job_options(&opt); |
927 opt.jo_mode = MODE_JSON; | 927 opt.jo_mode = MODE_JSON; |
928 opt.jo_timeout = 2000; | 928 opt.jo_timeout = 2000; |
929 if (get_job_options(&argvars[1], &opt, | 929 if (get_job_options(&argvars[1], &opt, |
930 JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL) == FAIL) | 930 JO_MODE_ALL + JO_CB_ALL + JO_WAITTIME + JO_TIMEOUT_ALL, 0) == FAIL) |
931 goto theend; | 931 goto theend; |
932 if (opt.jo_timeout < 0) | 932 if (opt.jo_timeout < 0) |
933 { | 933 { |
934 EMSG(_(e_invarg)); | 934 EMSG(_(e_invarg)); |
935 goto theend; | 935 goto theend; |
3427 /* return an empty string by default */ | 3427 /* return an empty string by default */ |
3428 rettv->v_type = VAR_STRING; | 3428 rettv->v_type = VAR_STRING; |
3429 rettv->vval.v_string = NULL; | 3429 rettv->vval.v_string = NULL; |
3430 | 3430 |
3431 clear_job_options(&opt); | 3431 clear_job_options(&opt); |
3432 if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID) | 3432 if (get_job_options(&argvars[1], &opt, JO_TIMEOUT + JO_PART + JO_ID, 0) |
3433 == FAIL) | 3433 == FAIL) |
3434 goto theend; | 3434 goto theend; |
3435 | 3435 |
3436 if (opt.jo_set & JO_PART) | 3436 if (opt.jo_set & JO_PART) |
3437 part = opt.jo_part; | 3437 part = opt.jo_part; |
3610 if (channel == NULL) | 3610 if (channel == NULL) |
3611 return NULL; | 3611 return NULL; |
3612 part_send = channel_part_send(channel); | 3612 part_send = channel_part_send(channel); |
3613 *part_read = channel_part_read(channel); | 3613 *part_read = channel_part_read(channel); |
3614 | 3614 |
3615 if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT) == FAIL) | 3615 if (get_job_options(&argvars[2], opt, JO_CALLBACK + JO_TIMEOUT, 0) == FAIL) |
3616 return NULL; | 3616 return NULL; |
3617 | 3617 |
3618 /* Set the callback. An empty callback means no callback and not reading | 3618 /* Set the callback. An empty callback means no callback and not reading |
3619 * the response. With "ch_evalexpr()" and "ch_evalraw()" a callback is not | 3619 * the response. With "ch_evalexpr()" and "ch_evalraw()" a callback is not |
3620 * allowed. */ | 3620 * allowed. */ |
4167 } | 4167 } |
4168 | 4168 |
4169 /* | 4169 /* |
4170 * Get the option entries from the dict in "tv", parse them and put the result | 4170 * Get the option entries from the dict in "tv", parse them and put the result |
4171 * in "opt". | 4171 * in "opt". |
4172 * Only accept options in "supported". | 4172 * Only accept JO_ options in "supported" and JO2_ options in "supported2". |
4173 * If an option value is invalid return FAIL. | 4173 * If an option value is invalid return FAIL. |
4174 */ | 4174 */ |
4175 int | 4175 int |
4176 get_job_options(typval_T *tv, jobopt_T *opt, int supported) | 4176 get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) |
4177 { | 4177 { |
4178 typval_T *item; | 4178 typval_T *item; |
4179 char_u *val; | 4179 char_u *val; |
4180 dict_T *dict; | 4180 dict_T *dict; |
4181 int todo; | 4181 int todo; |
4409 } | 4409 } |
4410 } | 4410 } |
4411 #ifdef FEAT_TERMINAL | 4411 #ifdef FEAT_TERMINAL |
4412 else if (STRCMP(hi->hi_key, "term_name") == 0) | 4412 else if (STRCMP(hi->hi_key, "term_name") == 0) |
4413 { | 4413 { |
4414 if (!(supported & JO2_TERM_NAME)) | 4414 if (!(supported2 & JO2_TERM_NAME)) |
4415 break; | 4415 break; |
4416 opt->jo_set2 |= JO2_TERM_NAME; | 4416 opt->jo_set2 |= JO2_TERM_NAME; |
4417 opt->jo_term_name = get_tv_string_chk(item); | 4417 opt->jo_term_name = get_tv_string_chk(item); |
4418 if (opt->jo_term_name == NULL) | 4418 if (opt->jo_term_name == NULL) |
4419 { | 4419 { |
4421 return FAIL; | 4421 return FAIL; |
4422 } | 4422 } |
4423 } | 4423 } |
4424 else if (STRCMP(hi->hi_key, "term_finish") == 0) | 4424 else if (STRCMP(hi->hi_key, "term_finish") == 0) |
4425 { | 4425 { |
4426 if (!(supported & JO2_TERM_FINISH)) | 4426 if (!(supported2 & JO2_TERM_FINISH)) |
4427 break; | 4427 break; |
4428 val = get_tv_string(item); | 4428 val = get_tv_string(item); |
4429 if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) | 4429 if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) |
4430 { | 4430 { |
4431 EMSG2(_(e_invarg2), val); | 4431 EMSG2(_(e_invarg2), val); |
4432 return FAIL; | 4432 return FAIL; |
4433 } | 4433 } |
4434 opt->jo_set2 |= JO2_TERM_FINISH; | 4434 opt->jo_set2 |= JO2_TERM_FINISH; |
4435 opt->jo_term_finish = *val; | 4435 opt->jo_term_finish = *val; |
4436 } | 4436 } |
4437 else if (STRCMP(hi->hi_key, "term_rows") == 0) | |
4438 { | |
4439 if (!(supported2 & JO2_TERM_ROWS)) | |
4440 break; | |
4441 opt->jo_set |= JO2_TERM_ROWS; | |
4442 opt->jo_term_rows = get_tv_number(item); | |
4443 } | |
4444 else if (STRCMP(hi->hi_key, "term_cols") == 0) | |
4445 { | |
4446 if (!(supported2 & JO2_TERM_COLS)) | |
4447 break; | |
4448 opt->jo_set |= JO2_TERM_COLS; | |
4449 opt->jo_term_cols = get_tv_number(item); | |
4450 } | |
4451 else if (STRCMP(hi->hi_key, "vertical") == 0) | |
4452 { | |
4453 if (!(supported2 & JO2_VERTICAL)) | |
4454 break; | |
4455 opt->jo_set |= JO2_VERTICAL; | |
4456 opt->jo_vertical = get_tv_number(item); | |
4457 } | |
4437 #endif | 4458 #endif |
4438 else if (STRCMP(hi->hi_key, "env") == 0) | 4459 else if (STRCMP(hi->hi_key, "env") == 0) |
4439 { | 4460 { |
4440 if (!(supported & JO2_ENV)) | 4461 if (!(supported2 & JO2_ENV)) |
4441 break; | 4462 break; |
4442 opt->jo_set |= JO2_ENV; | 4463 opt->jo_set |= JO2_ENV; |
4443 opt->jo_env = item->vval.v_dict; | 4464 opt->jo_env = item->vval.v_dict; |
4444 ++item->vval.v_dict->dv_refcount; | 4465 ++item->vval.v_dict->dv_refcount; |
4445 } | 4466 } |
4446 else if (STRCMP(hi->hi_key, "cwd") == 0) | 4467 else if (STRCMP(hi->hi_key, "cwd") == 0) |
4447 { | 4468 { |
4448 if (!(supported & JO2_CWD)) | 4469 if (!(supported2 & JO2_CWD)) |
4449 break; | 4470 break; |
4450 opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); | 4471 opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); |
4451 if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)) | 4472 if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)) |
4452 { | 4473 { |
4453 EMSG2(_(e_invarg2), "cwd"); | 4474 EMSG2(_(e_invarg2), "cwd"); |
4954 /* Default mode is NL. */ | 4975 /* Default mode is NL. */ |
4955 clear_job_options(&opt); | 4976 clear_job_options(&opt); |
4956 opt.jo_mode = MODE_NL; | 4977 opt.jo_mode = MODE_NL; |
4957 if (get_job_options(&argvars[1], &opt, | 4978 if (get_job_options(&argvars[1], &opt, |
4958 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT | 4979 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT |
4959 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL) | 4980 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE, 0) == FAIL) |
4960 goto theend; | 4981 goto theend; |
4961 } | 4982 } |
4962 | 4983 |
4963 /* Check that when io is "file" that there is a file name. */ | 4984 /* Check that when io is "file" that there is a file name. */ |
4964 for (part = PART_OUT; part < PART_COUNT; ++part) | 4985 for (part = PART_OUT; part < PART_COUNT; ++part) |