To: vim_dev@googlegroups.com Subject: Patch 8.0.0868 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0868 Problem: Cannot specify the terminal size on the command line. Solution: Use the address range for the terminal size. (Yasuhiro Matsumoto, closes #1941) Files: src/terminal.c, src/testdir/test_terminal.vim *** ../vim-8.0.0867/src/terminal.c 2017-08-05 15:16:28.169244309 +0200 --- src/terminal.c 2017-08-05 17:04:51.668645281 +0200 *************** *** 257,262 **** --- 257,273 ---- split_ea.cmdidx = CMD_new; split_ea.cmd = (char_u *)"new"; split_ea.arg = (char_u *)""; + if (opt->jo_term_rows > 0 && !(cmdmod.split & WSP_VERT)) + { + split_ea.line2 = opt->jo_term_rows; + split_ea.addr_count = 1; + } + if (opt->jo_term_cols > 0 && (cmdmod.split & WSP_VERT)) + { + split_ea.line2 = opt->jo_term_cols; + split_ea.addr_count = 1; + } + ex_splitview(&split_ea); if (curwin == old_curwin) { *************** *** 267,272 **** --- 278,289 ---- term->tl_buffer = curbuf; curbuf->b_term = term; + /* only one size was taken care of with :new, do the other one */ + if (opt->jo_term_rows > 0 && (cmdmod.split & WSP_VERT)) + win_setheight(opt->jo_term_rows); + if (opt->jo_term_cols > 0 && !(cmdmod.split & WSP_VERT)) + win_setwidth(opt->jo_term_cols); + /* Link the new terminal in the list of active terminals. */ term->tl_next = first_term; first_term = term; *************** *** 338,344 **** jobopt_T opt; init_job_options(&opt); ! /* TODO: get options from before the command */ term_start(eap->arg, &opt); } --- 355,374 ---- jobopt_T opt; init_job_options(&opt); ! ! if (eap->addr_count == 2) ! { ! opt.jo_term_rows = eap->line1; ! opt.jo_term_cols = eap->line2; ! } ! else if (eap->addr_count == 1) ! { ! if (cmdmod.split & WSP_VERT) ! opt.jo_term_cols = eap->line2; ! else ! opt.jo_term_rows = eap->line2; ! } ! /* TODO: get more options from before the command */ term_start(eap->arg, &opt); } *** ../vim-8.0.0867/src/testdir/test_terminal.vim 2017-08-05 16:33:52.530755674 +0200 --- src/testdir/test_terminal.vim 2017-08-05 17:03:23.869326756 +0200 *************** *** 171,173 **** --- 171,199 ---- exe buf . 'bwipe' call delete('Xtext') endfunc + + func Test_terminal_size() + let cmd = Get_cat_cmd() + + exe '5terminal ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal(5, size[0]) + + vsplit + exe '5,33terminal ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal([5, 33], size) + + exe 'vertical 20terminal ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal(20, size[1]) + + split + exe 'vertical 6,20terminal ' . cmd + let size = term_getsize('') + bwipe! + call assert_equal([6, 20], size) + endfunc *** ../vim-8.0.0867/src/version.c 2017-08-05 16:33:52.530755674 +0200 --- src/version.c 2017-08-05 17:06:06.040068338 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 868, /**/ -- Did you ever stop to think... and forget to start again? -- Steven Wright /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///