aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-01-26 12:37:38 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2019-01-27 12:07:06 +0100
commit30bd1c1e85d2fcffa24a87803bec3070e52c7c7e (patch)
tree4a959f9ee8a6050bc7755cc169be5079724c574b /src/nvim/terminal.c
parent2ab70cb55c80b17fb4100dd7f2d056131c02b08b (diff)
downloadrneovim-30bd1c1e85d2fcffa24a87803bec3070e52c7c7e.tar.gz
rneovim-30bd1c1e85d2fcffa24a87803bec3070e52c7c7e.tar.bz2
rneovim-30bd1c1e85d2fcffa24a87803bec3070e52c7c7e.zip
terminal: handle size when switching buffers in window
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index e2e3bc5f30..6516f46b2f 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -337,19 +337,16 @@ void terminal_close(Terminal *term, char *msg)
void terminal_check_size(Terminal *term)
{
if (term->closed) {
- // TODO: WTF does this mean:
- // If two windows display the same terminal and one is closed by keypress.
return;
}
+
int curwidth, curheight;
vterm_get_size(term->vt, &curheight, &curwidth);
uint16_t width = 0, height = 0;
- bool window_seen = false;
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp->w_buffer && wp->w_buffer->terminal == term) {
- window_seen = true;
const uint16_t win_width =
(uint16_t)(MAX(0, wp->w_width_inner - win_col_off(wp)));
width = MAX(width, win_width);
@@ -357,6 +354,8 @@ void terminal_check_size(Terminal *term)
}
}
+ // if no window displays the terminal, or such all windows are zero-height,
+ // don't resize the terminal.
if ((curheight == height && curwidth == width) || height == 0 || width == 0) {
return;
}