summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-05 16:08:49 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-05 16:08:49 +0200
commit2ce14589f210dcb3d17d1d80285256f8ac10abab (patch)
treed2b887591c8424ce49ea6c02408a1fe033014ece
parent8b5866ded6036f7adece26b6d16962bbd2d47842 (diff)
patch 8.2.1598: starting a hidden terminal resizes the current windowv8.2.1598
Problem: Starting a hidden terminal resizes the current window. Solution: Do not resize the current window for a hidden terminal. (closes #6872)
-rw-r--r--src/terminal.c24
-rw-r--r--src/testdir/test_terminal2.vim10
-rw-r--r--src/version.c2
3 files changed, 26 insertions, 10 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 7856ad586c..cab9cb9c66 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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);
+ }
}
}
diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim
index a99818b8d7..64310f6254 100644
--- 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
diff --git a/src/version.c b/src/version.c
index 4dfad08fb1..b6a6f41cb7 100644
--- 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,