mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
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.
This commit is contained in:
parent
0f76f4190a
commit
a35738d96f
6 changed files with 170 additions and 210 deletions
19
terminal.h
19
terminal.h
|
|
@ -28,9 +28,12 @@ struct cell {
|
|||
struct attributes attrs;
|
||||
};
|
||||
|
||||
enum damage_type {DAMAGE_UPDATE, DAMAGE_UPDATE_NO_SCROLL,
|
||||
DAMAGE_ERASE, DAMAGE_ERASE_NO_SCROLL,
|
||||
DAMAGE_SCROLL, DAMAGE_SCROLL_REVERSE};
|
||||
struct scroll_region {
|
||||
int start;
|
||||
int end;
|
||||
};
|
||||
|
||||
enum damage_type {DAMAGE_UPDATE, DAMAGE_ERASE, DAMAGE_SCROLL, DAMAGE_SCROLL_REVERSE};
|
||||
struct damage {
|
||||
enum damage_type type;
|
||||
union {
|
||||
|
|
@ -42,7 +45,7 @@ struct damage {
|
|||
|
||||
/* DAMAGE_SCROLL, DAMAGE_SCROLL_REVERSE */
|
||||
struct {
|
||||
int offset;
|
||||
struct scroll_region region;
|
||||
int lines;
|
||||
} scroll;
|
||||
};
|
||||
|
|
@ -54,12 +57,7 @@ struct grid {
|
|||
int cell_width;
|
||||
int cell_height;
|
||||
|
||||
/* Scrolling region - counted as lines excluded from scrolling,
|
||||
* from top and from bottom */
|
||||
struct {
|
||||
int start;
|
||||
int end;
|
||||
} scrolling_region;
|
||||
struct scroll_region scroll_region;
|
||||
|
||||
int linear_cursor;
|
||||
struct {
|
||||
|
|
@ -80,6 +78,7 @@ struct grid {
|
|||
uint32_t background;
|
||||
|
||||
tll(struct damage) damage;
|
||||
tll(struct damage) scroll_damage;
|
||||
};
|
||||
|
||||
struct vt_subparams {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue