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. --- vt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vt.c') diff --git a/vt.c b/vt.c index 710b706e..b74202bf 100644 --- a/vt.c +++ b/vt.c @@ -604,7 +604,7 @@ action(struct terminal *term, enum action action, uint8_t c) LOG_DBG("execute: 0x%02x", c); switch (c) { case '\n': - if (term->grid.cursor.row == term->grid.scrolling_region.end - 1) { + if (term->grid.cursor.row == term->grid.scroll_region.end - 1) { grid_scroll(&term->grid, 1); } else grid_cursor_down(&term->grid, 1); @@ -638,7 +638,7 @@ action(struct terminal *term, enum action action, uint8_t c) case ACTION_PRINT: { if (term->grid.print_needs_wrap) { - if (term->grid.cursor.row == term->grid.scrolling_region.end - 1) { + if (term->grid.cursor.row == term->grid.scroll_region.end - 1) { grid_scroll(&term->grid, 1); grid_cursor_to(&term->grid, term->grid.cursor.row, 0); } else -- cgit v1.3