changeset 22097:f369bbd71a53 v8.2.1598

patch 8.2.1598: starting a hidden terminal resizes the current window Commit: https://github.com/vim/vim/commit/2ce14589f210dcb3d17d1d80285256f8ac10abab Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 5 16:08:49 2020 +0200 patch 8.2.1598: starting a hidden terminal resizes the current window Problem: Starting a hidden terminal resizes the current window. Solution: Do not resize the current window for a hidden terminal. (closes #6872)
author Bram Moolenaar <Bram@vim.org>
date Sat, 05 Sep 2020 16:15:03 +0200
parents e0eedfb389af
children 17faee57791f
files src/terminal.c src/testdir/test_terminal2.vim src/version.c
diffstat 3 files changed, 28 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -315,18 +315,22 @@ set_term_and_win_size(term_T *term, jobo
     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);
+    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);
+	}
     }
 }
 
--- a/src/testdir/test_terminal2.vim
+++ b/src/testdir/test_terminal2.vim
@@ -130,6 +130,16 @@ func Test_terminal_termwinsize_overruled
   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
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1598,
+/**/
     1597,
 /**/
     1596,