To: vim_dev@googlegroups.com Subject: Patch 8.2.1598 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1598 Problem: Starting a hidden terminal resizes the current window. Solution: Do not resize the current window for a hidden terminal. (closes #6872) Files: src/terminal.c, src/testdir/test_terminal2.vim *** ../vim-8.2.1597/src/terminal.c 2020-09-04 18:34:06.116621660 +0200 --- src/terminal.c 2020-09-05 16:06:37.854573541 +0200 *************** *** 315,332 **** else if (cols != 0) term->tl_cols = cols; ! if (term->tl_rows != curwin->w_height) ! win_setheight_win(term->tl_rows, curwin); ! if (term->tl_cols != curwin->w_width) ! win_setwidth_win(term->tl_cols, curwin); ! ! // Set 'winsize' now to avoid a resize at the next redraw. ! if (!minsize && *curwin->w_p_tws != NUL) { ! char_u buf[100]; ! vim_snprintf((char *)buf, 100, "%dx%d", term->tl_rows, term->tl_cols); ! set_option_value((char_u *)"termwinsize", 0L, buf, OPT_LOCAL); } } --- 315,336 ---- else if (cols != 0) term->tl_cols = cols; ! if (!opt->jo_hidden) { ! if (term->tl_rows != curwin->w_height) ! win_setheight_win(term->tl_rows, curwin); ! if (term->tl_cols != curwin->w_width) ! win_setwidth_win(term->tl_cols, curwin); ! ! // Set 'winsize' now to avoid a resize at the next redraw. ! if (!minsize && *curwin->w_p_tws != NUL) ! { ! char_u buf[100]; ! vim_snprintf((char *)buf, 100, "%dx%d", ! term->tl_rows, term->tl_cols); ! set_option_value((char_u *)"termwinsize", 0L, buf, OPT_LOCAL); ! } } } *** ../vim-8.2.1597/src/testdir/test_terminal2.vim 2020-09-04 21:18:40.488161918 +0200 --- src/testdir/test_terminal2.vim 2020-09-05 16:05:54.754686555 +0200 *************** *** 130,135 **** --- 130,145 ---- set termwinsize= endfunc + " hidden terminal must not change current window size + func Test_terminal_hidden_winsize() + let cmd = GetDummyCmd() + let rows = winheight(0) + let buf = term_start(cmd, #{hidden: 1, term_rows: 10}) + call assert_equal(rows, winheight(0)) + call assert_equal([10, &columns], term_getsize(buf)) + exe "bwipe! " .. buf + endfunc + func Test_terminal_termwinkey() " make three tabpages, terminal in the middle 0tabnew *** ../vim-8.2.1597/src/version.c 2020-09-05 15:48:32.473546679 +0200 --- src/version.c 2020-09-05 16:07:24.202452229 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1598, /**/ -- Seen on the back of a biker's vest: If you can read this, my wife fell off. /// 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 ///