ui: fix glitches where scrolling region affects clearing of screen

the first implemented UI protocol clients (python-gui and builitin TUI)
allowed the cleared region to be restricted by setting the scroll region.
This was never used by nvim though, and not documented and implemented by
newer clients, to check we remain compatible with both kind of clients,
ensure the scroll region is in a reset state.
This commit is contained in:
Björn Linse 2018-07-24 09:55:31 +02:00
parent d545413492
commit dcac926ced
3 changed files with 11 additions and 2 deletions

View File

@ -302,6 +302,15 @@ static void remote_ui_grid_scroll(UI *ui, Integer grid, Integer top,
args = (Array)ARRAY_DICT_INIT;
ADD(args, INTEGER_OBJ(rows));
push_call(ui, "scroll", args);
// some clients have "clear" being affected by scroll region,
// so reset it.
args = (Array)ARRAY_DICT_INIT;
ADD(args, INTEGER_OBJ(0));
ADD(args, INTEGER_OBJ(ui->height-1));
ADD(args, INTEGER_OBJ(0));
ADD(args, INTEGER_OBJ(ui->width-1));
push_call(ui, "set_scroll_region", args);
}
}

View File

@ -823,7 +823,7 @@ static void tui_grid_clear(UI *ui, Integer g)
UGrid *grid = &data->grid;
ugrid_clear(grid);
kv_size(data->invalid_regions) = 0;
clear_region(ui, grid->top, grid->bot, grid->left, grid->right,
clear_region(ui, 0, grid->height-1, 0, grid->width-1,
data->clear_attrs);
}

View File

@ -44,7 +44,7 @@ void ugrid_resize(UGrid *grid, int width, int height)
void ugrid_clear(UGrid *grid)
{
clear_region(grid, grid->top, grid->bot, grid->left, grid->right,
clear_region(grid, 0, grid->height-1, 0, grid->width-1,
HLATTRS_INIT);
}