tui: clip invalid regions on resize (#8779), fixes #8774

This commit is contained in:
Björn Linse 2018-07-26 19:55:26 +02:00 committed by GitHub
parent 9c0c5e8bc6
commit 5f15788dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -802,7 +802,16 @@ static void reset_scroll_region(UI *ui)
static void tui_grid_resize(UI *ui, Integer g, Integer width, Integer height)
{
TUIData *data = ui->data;
ugrid_resize(&data->grid, (int)width, (int)height);
UGrid *grid = &data->grid;
ugrid_resize(grid, (int)width, (int)height);
// resize might not always be followed by a clear before flush
// so clip the invalid region
for (size_t i = 0; i < kv_size(data->invalid_regions); i++) {
Rect *r = &kv_A(data->invalid_regions, i);
r->bot = MIN(r->bot, grid->height-1);
r->right = MIN(r->right, grid->width-1);
}
if (!got_winch) { // Try to resize the terminal window.
UNIBI_SET_NUM_VAR(data->params[0], (int)height);