Merge #2762 'terminal: don't set vterm size to 0'

This commit is contained in:
Justin M. Keyes 2015-05-31 11:53:08 -04:00
commit deb65188ac
3 changed files with 32 additions and 26 deletions

View File

@ -313,6 +313,10 @@ void terminal_resize(Terminal *term, uint16_t width, uint16_t height)
return; return;
} }
if (height == 0 || width == 0) {
return;
}
vterm_set_size(term->vt, height, width); vterm_set_size(term->vt, height, width);
vterm_screen_flush_damage(term->vts); vterm_screen_flush_damage(term->vts);
term->pending_resize = true; term->pending_resize = true;

View File

@ -4745,7 +4745,9 @@ void win_new_width(win_T *wp, int width)
wp->w_redr_status = TRUE; wp->w_redr_status = TRUE;
if (wp->w_buffer->terminal) { if (wp->w_buffer->terminal) {
terminal_resize(wp->w_buffer->terminal, wp->w_width, 0); if (wp->w_height != 0) {
terminal_resize(wp->w_buffer->terminal, wp->w_width, 0);
}
redraw_win_later(wp, CLEAR); redraw_win_later(wp, CLEAR);
} }
} }

View File

@ -110,39 +110,39 @@ describe('terminal mouse', function()
before_each(function() before_each(function()
feed('<c-\\><c-n>:vsp<cr>') feed('<c-\\><c-n>:vsp<cr>')
screen:expect([[ screen:expect([[
line21 |line21 | line28 |line28 |
line22 |line22 | line29 |line29 |
line23 |line23 | line30 |line30 |
line24 |line24 | rows: 5, cols: 24 |rows: 5, cols: 24 |
^rows: 5, cols: 24 |rows: 5, cols: 24 | {2:^ } |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])
feed(':enew | set number<cr>') feed(':enew | set number<cr>')
screen:expect([[ screen:expect([[
1 ^ |line21 | 1 ^ |line28 |
~ |line22 | ~ |line29 |
~ |line23 | ~ |line30 |
~ |line24 |
~ |rows: 5, cols: 24 | ~ |rows: 5, cols: 24 |
~ |{2: } |
========== ========== | ========== ========== |
:enew | set number | :enew | set number |
]]) ]])
feed('30iline\n<esc>') feed('30iline\n<esc>')
screen:expect([[ screen:expect([[
27 line |line21 | 27 line |line28 |
28 line |line22 | 28 line |line29 |
29 line |line23 | 29 line |line30 |
30 line |line24 | 30 line |rows: 5, cols: 24 |
31 ^ |rows: 5, cols: 24 | 31 ^ |{2: } |
========== ========== | ========== ========== |
| |
]]) ]])
feed('<c-w>li') feed('<c-w>li')
screen:expect([[ screen:expect([[
27 line |line22 | 27 line |line28 |
28 line |line23 | 28 line |line29 |
29 line |line24 | 29 line |line30 |
30 line |rows: 5, cols: 24 | 30 line |rows: 5, cols: 24 |
31 |{1: } | 31 |{1: } |
========== ========== | ========== ========== |
@ -152,8 +152,8 @@ describe('terminal mouse', function()
thelpers.enable_mouse() thelpers.enable_mouse()
thelpers.feed_data('mouse enabled\n') thelpers.feed_data('mouse enabled\n')
screen:expect([[ screen:expect([[
27 line |line23 | 27 line |line29 |
28 line |line24 | 28 line |line30 |
29 line |rows: 5, cols: 24 | 29 line |rows: 5, cols: 24 |
30 line |mouse enabled | 30 line |mouse enabled |
31 |{1: } | 31 |{1: } |
@ -165,8 +165,8 @@ describe('terminal mouse', function()
it('wont lose focus if another window is scrolled', function() it('wont lose focus if another window is scrolled', function()
feed('<MouseDown><0,0><MouseDown><0,0>') feed('<MouseDown><0,0><MouseDown><0,0>')
screen:expect([[ screen:expect([[
21 line |line23 | 21 line |line29 |
22 line |line24 | 22 line |line30 |
23 line |rows: 5, cols: 24 | 23 line |rows: 5, cols: 24 |
24 line |mouse enabled | 24 line |mouse enabled |
25 line |{1: } | 25 line |{1: } |
@ -175,8 +175,8 @@ describe('terminal mouse', function()
]]) ]])
feed('<S-MouseUp><0,0>') feed('<S-MouseUp><0,0>')
screen:expect([[ screen:expect([[
26 line |line23 | 26 line |line29 |
27 line |line24 | 27 line |line30 |
28 line |rows: 5, cols: 24 | 28 line |rows: 5, cols: 24 |
29 line |mouse enabled | 29 line |mouse enabled |
30 line |{1: } | 30 line |{1: } |
@ -188,8 +188,8 @@ describe('terminal mouse', function()
it('will lose focus if another window is clicked', function() it('will lose focus if another window is clicked', function()
feed('<LeftMouse><5,1>') feed('<LeftMouse><5,1>')
screen:expect([[ screen:expect([[
27 line |line23 | 27 line |line29 |
28 l^ine |line24 | 28 l^ine |line30 |
29 line |rows: 5, cols: 24 | 29 line |rows: 5, cols: 24 |
30 line |mouse enabled | 30 line |mouse enabled |
31 |{2: } | 31 |{2: } |