Skip to content

Commit 71b2964

Browse files
committed
patch 8.0.1126: endless resize when terminal showing in two buffers
Problem: Endless resize when terminal showing in two buffers. (Hirohito Higashi) Solution: Set a flag to prevent resizing the window.
1 parent d326ad6 commit 71b2964

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/terminal.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ struct terminal_S {
9999
job_T *tl_job;
100100
buf_T *tl_buffer;
101101

102+
/* Set when setting the size of a vterm, reset after redrawing. */
103+
int tl_vterm_size_changed;
104+
102105
/* used when tl_job is NULL and only a pty was created */
103106
int tl_tty_fd;
104107
char_u *tl_tty_in;
@@ -2017,16 +2020,21 @@ handle_resize(int rows, int cols, void *user)
20172020

20182021
term->tl_rows = rows;
20192022
term->tl_cols = cols;
2020-
FOR_ALL_WINDOWS(wp)
2023+
if (term->tl_vterm_size_changed)
2024+
/* Size was set by vterm_set_size(), don't set the window size. */
2025+
term->tl_vterm_size_changed = FALSE;
2026+
else
20212027
{
2022-
if (wp->w_buffer == term->tl_buffer)
2028+
FOR_ALL_WINDOWS(wp)
20232029
{
2024-
win_setheight_win(rows, wp);
2025-
win_setwidth_win(cols, wp);
2030+
if (wp->w_buffer == term->tl_buffer)
2031+
{
2032+
win_setheight_win(rows, wp);
2033+
win_setwidth_win(cols, wp);
2034+
}
20262035
}
2036+
redraw_buf_later(term->tl_buffer, NOT_VALID);
20272037
}
2028-
2029-
redraw_buf_later(term->tl_buffer, NOT_VALID);
20302038
return 1;
20312039
}
20322040

@@ -2223,6 +2231,7 @@ term_update_window(win_T *wp)
22232231
}
22242232
}
22252233

2234+
term->tl_vterm_size_changed = TRUE;
22262235
vterm_set_size(vterm, rows, cols);
22272236
ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines",
22282237
rows);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1126,
764766
/**/
765767
1125,
766768
/**/

0 commit comments

Comments
 (0)