]> granicus.if.org Git - vim/commitdiff
patch 8.2.1598: starting a hidden terminal resizes the current window v8.2.1598
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 14:08:49 +0000 (16:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 14:08:49 +0000 (16:08 +0200)
Problem:    Starting a hidden terminal resizes the current window.
Solution:   Do not resize the current window for a hidden terminal.
            (closes #6872)

src/terminal.c
src/testdir/test_terminal2.vim
src/version.c

index 7856ad586ca90f4571bdbb2411f1a861460c363b..cab9cb9c665e0d3b6bf778ae07b67326756a52ed 100644 (file)
@@ -315,18 +315,22 @@ set_term_and_win_size(term_T *term, jobopt_T *opt)
     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)
+    if (!opt->jo_hidden)
     {
-       char_u buf[100];
+       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);
 
-       vim_snprintf((char *)buf, 100, "%dx%d", term->tl_rows, term->tl_cols);
-       set_option_value((char_u *)"termwinsize", 0L, buf, OPT_LOCAL);
+       // 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);
+       }
     }
 }
 
index a99818b8d75f8607546689c4b7aa67fe940dce5d..64310f6254fd171e4de6c633daa203ea9f2592fb 100644 (file)
@@ -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
index 4dfad08fb18cffe251131c39e70ecbd67e12d263..b6a6f41cb705570af493eb06a7deafdb7c50e65f 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1598,
 /**/
     1597,
 /**/