From a35738d96f251379074a8e79ec2c179afcfe79fa Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 25 Jun 2019 20:11:08 +0200 Subject: scroll-region: don't clear damage queue when changing scroll region Vim, for example, changes the scroll region every time you scroll a single line. Thus, resetting the damage queue is slow. This reworks the damage handling of scroll updates: * Split damage queue into two: one for scroll operations and one for update/erase operations. * Don't separate update/erase operations inside/outside the scroll region * Store the current scroll region in the scroll damage operation. This allows us to stack multiple scroll operations with different scroll regions. * When updating update/erase operations after a scroll operation, split the update/erase operations if necessary (the current scroll operation may have a scroll region different from before, thus forcing us to split existing update/erase operations. * The renderer no longer erases after a scroll. The scroll operation also adds an erase operation. This also means that erase operation are subject to adjustments by later scroll operations. --- grid.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'grid.h') diff --git a/grid.h b/grid.h index d27099cd..4854582d 100644 --- a/grid.h +++ b/grid.h @@ -2,10 +2,12 @@ #include "terminal.h" +void grid_damage_all(struct grid *grid); void grid_damage_update(struct grid *grid, int start, int length); void grid_damage_erase(struct grid *grid, int start, int length); void grid_damage_scroll( - struct grid *grid, enum damage_type damage_type, int offset, int lines); + struct grid *grid, enum damage_type damage_type, + struct scroll_region region, int lines); void grid_erase(struct grid *grid, int start, int end); @@ -18,8 +20,10 @@ void grid_cursor_down(struct grid *grid, int count); void grid_scroll(struct grid *grid, int rows); void grid_scroll_reverse(struct grid *grid, int rows); -void grid_scroll_partial(struct grid *grid, int offset, int rows); -void grid_scroll_reverse_partial(struct grid *grid, int offset, int rows); +void grid_scroll_partial( + struct grid *grid, struct scroll_region region, int rows); +void grid_scroll_reverse_partial( + struct grid *grid, struct scroll_region region, int rows); int grid_cursor_linear(const struct grid *grid, int row, int col); -- cgit v1.3