diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-05 16:29:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-09 05:44:18 +0000 |
| commit | 5ebab9dea94c1fd06293e71ea3b904bc9902ad1e (patch) | |
| tree | 723ac1eab358f9425b2eb836cf949f3b7d557e9e /sixel.c | |
| parent | sixel: add comments to verify_*() functions (diff) | |
sixel: verify scrollback consistency: new verify function
Verifies sixels have been scrolled out correctly
Diffstat (limited to 'sixel.c')
| -rw-r--r-- | sixel.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -180,6 +180,31 @@ verify_no_wraparound_crossover(const struct terminal *term) } /* + * Verify there aren't any sixels that cross the scrollback end. This + * invariant means a sixel's rebased row numbers are strictly + * increasing. + */ +static void +verify_scrollback_consistency(const struct terminal *term) +{ +#if defined(_DEBUG) + tll_foreach(term->grid->sixel_images, it) { + const struct sixel *six = &it->item; + + int last_row = -1; + for (int i = 0; i < six->rows; i++) { + int row_no = rebase_row(term, six->pos.row + i); + + if (last_row != -1) + assert(last_row < row_no); + + last_row = row_no; + } + } +#endif +} + +/* * Verifies no sixel overlap with any other sixels. */ static void @@ -223,6 +248,7 @@ static void verify_sixels(const struct terminal *term) { verify_no_wraparound_crossover(term); + verify_scrollback_consistency(term); verify_no_overlap(term); verify_list_order(term); } |
