fix(terminal): check terminal size at end of screen update

This commit is contained in:
zeertzjq
2023-10-03 10:23:03 +08:00
parent 749ff7a342
commit e0d98bd25d
2 changed files with 36 additions and 11 deletions

View File

@@ -1453,16 +1453,12 @@ static void win_update(win_T *wp, DecorProviders *providers)
init_search_hl(wp, &screen_search_hl); init_search_hl(wp, &screen_search_hl);
// Force redraw when width of 'number' or 'relativenumber' column const int nrwidth_before = wp->w_nrwidth;
// changes. int nrwidth_new = (wp->w_p_nu || wp->w_p_rnu || *wp->w_p_stc) ? number_width(wp) : 0;
int nrwidth = (wp->w_p_nu || wp->w_p_rnu || *wp->w_p_stc) ? number_width(wp) : 0; // Force redraw when width of 'number' or 'relativenumber' column changes.
if (wp->w_nrwidth != nrwidth) { if (wp->w_nrwidth != nrwidth_new) {
type = UPD_NOT_VALID; type = UPD_NOT_VALID;
wp->w_nrwidth = nrwidth; wp->w_nrwidth = nrwidth_new;
if (buf->terminal) {
terminal_check_size(buf->terminal);
}
} else if (buf->b_mod_set } else if (buf->b_mod_set
&& buf->b_mod_xlines != 0 && buf->b_mod_xlines != 0
&& wp->w_redraw_top != 0) { && wp->w_redraw_top != 0) {
@@ -2414,6 +2410,10 @@ static void win_update(win_T *wp, DecorProviders *providers)
} }
} }
if (nrwidth_before != wp->w_nrwidth && buf->terminal) {
terminal_check_size(buf->terminal);
}
// restore got_int, unless CTRL-C was hit while redrawing // restore got_int, unless CTRL-C was hit while redrawing
if (!got_int) { if (!got_int) {
got_int = save_got_int; got_int = save_got_int;

View File

@@ -44,7 +44,7 @@ describe(':terminal window', function()
{7:6 } | {7:6 } |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) feed_data('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
screen:expect([[ screen:expect([[
{7:1 }tty ready | {7:1 }tty ready |
{7:2 }rows: 6, cols: 48 | {7:2 }rows: 6, cols: 48 |
@@ -69,7 +69,7 @@ describe(':terminal window', function()
{7: 6 } | {7: 6 } |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) feed_data(' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
screen:expect([[ screen:expect([[
{7: 1 }tty ready | {7: 1 }tty ready |
{7: 2 }rows: 6, cols: 48 | {7: 2 }rows: 6, cols: 48 |
@@ -82,6 +82,31 @@ describe(':terminal window', function()
end) end)
end) end)
describe("with 'statuscolumn'", function()
it('wraps text', function()
command([[set number statuscolumn=++%l\ \ ]])
screen:expect([[
{7:++1 }tty ready |
{7:++2 }rows: 6, cols: 45 |
{7:++3 }{1: } |
{7:++4 } |
{7:++5 } |
{7:++6 } |
{3:-- TERMINAL --} |
]])
feed_data('\n\n\n\n\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
screen:expect([[
{7:++4 } |
{7:++5 } |
{7:++6 } |
{7:++7 } |
{7:++8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS|
{7:++9 }TUVWXYZ{1: } |
{3:-- TERMINAL --} |
]])
end)
end)
describe("with 'colorcolumn'", function() describe("with 'colorcolumn'", function()
before_each(function() before_each(function()
feed([[<C-\><C-N>]]) feed([[<C-\><C-N>]])