comparison src/terminal.c @ 11975:5cc005cf312f v8.0.0868

patch 8.0.0868: cannot specify the terminal size on the command line commit https://github.com/vim/vim/commit/cfcc022c54e66b317ddcc8a807977230b056a542 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 5 17:13:48 2017 +0200 patch 8.0.0868: cannot specify the terminal size on the command line Problem: Cannot specify the terminal size on the command line. Solution: Use the address range for the terminal size. (Yasuhiro Matsumoto, closes #1941)
author Christian Brabandt <cb@256bit.org>
date Sat, 05 Aug 2017 17:15:04 +0200
parents 2baa88d64217
children 701aea3bc68b
comparison
equal deleted inserted replaced
11974:04f021e507e2 11975:5cc005cf312f
255 /* Open a new window or tab. */ 255 /* Open a new window or tab. */
256 vim_memset(&split_ea, 0, sizeof(split_ea)); 256 vim_memset(&split_ea, 0, sizeof(split_ea));
257 split_ea.cmdidx = CMD_new; 257 split_ea.cmdidx = CMD_new;
258 split_ea.cmd = (char_u *)"new"; 258 split_ea.cmd = (char_u *)"new";
259 split_ea.arg = (char_u *)""; 259 split_ea.arg = (char_u *)"";
260 if (opt->jo_term_rows > 0 && !(cmdmod.split & WSP_VERT))
261 {
262 split_ea.line2 = opt->jo_term_rows;
263 split_ea.addr_count = 1;
264 }
265 if (opt->jo_term_cols > 0 && (cmdmod.split & WSP_VERT))
266 {
267 split_ea.line2 = opt->jo_term_cols;
268 split_ea.addr_count = 1;
269 }
270
260 ex_splitview(&split_ea); 271 ex_splitview(&split_ea);
261 if (curwin == old_curwin) 272 if (curwin == old_curwin)
262 { 273 {
263 /* split failed */ 274 /* split failed */
264 vim_free(term); 275 vim_free(term);
265 return; 276 return;
266 } 277 }
267 term->tl_buffer = curbuf; 278 term->tl_buffer = curbuf;
268 curbuf->b_term = term; 279 curbuf->b_term = term;
280
281 /* only one size was taken care of with :new, do the other one */
282 if (opt->jo_term_rows > 0 && (cmdmod.split & WSP_VERT))
283 win_setheight(opt->jo_term_rows);
284 if (opt->jo_term_cols > 0 && !(cmdmod.split & WSP_VERT))
285 win_setwidth(opt->jo_term_cols);
269 286
270 /* Link the new terminal in the list of active terminals. */ 287 /* Link the new terminal in the list of active terminals. */
271 term->tl_next = first_term; 288 term->tl_next = first_term;
272 first_term = term; 289 first_term = term;
273 290
336 ex_terminal(exarg_T *eap) 353 ex_terminal(exarg_T *eap)
337 { 354 {
338 jobopt_T opt; 355 jobopt_T opt;
339 356
340 init_job_options(&opt); 357 init_job_options(&opt);
341 /* TODO: get options from before the command */ 358
359 if (eap->addr_count == 2)
360 {
361 opt.jo_term_rows = eap->line1;
362 opt.jo_term_cols = eap->line2;
363 }
364 else if (eap->addr_count == 1)
365 {
366 if (cmdmod.split & WSP_VERT)
367 opt.jo_term_cols = eap->line2;
368 else
369 opt.jo_term_rows = eap->line2;
370 }
371 /* TODO: get more options from before the command */
342 372
343 term_start(eap->arg, &opt); 373 term_start(eap->arg, &opt);
344 } 374 }
345 375
346 /* 376 /*