diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-04 11:09:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-11 17:25:29 +0000 |
| commit | 74c7373efcfe1d86a273b58a3e87559a88865e53 (patch) | |
| tree | c915bbd43297573d8a1529e90546bf9beecbdc08 | |
| parent | sixel: debug: more fine-grained verification of sixel image list (diff) | |
sixel: add sixel_cell_size_changed()
This function should be called *after* the cell dimensions have
changed, but *before* resizing/reflowing the grids.
| -rw-r--r-- | sixel.c | 24 | ||||
| -rw-r--r-- | sixel.h | 1 |
2 files changed, 25 insertions, 0 deletions
@@ -485,6 +485,30 @@ sixel_overwrite_at_cursor(struct terminal *term, int width) } void +sixel_cell_size_changed(struct terminal *term) +{ + struct grid *g = term->grid; + + term->grid = &term->normal; + tll_foreach(term->normal.sixel_images, it) { + struct sixel *six = &it->item; + six->rows = (six->height + term->cell_height - 1) / term->cell_height; + six->cols = (six->width + term->cell_width - 1) / term->cell_width; + } + verify_sixels(term); + + term->grid = &term->alt; + tll_foreach(term->alt.sixel_images, it) { + struct sixel *six = &it->item; + six->rows = (six->height + term->cell_height - 1) / term->cell_height; + six->cols = (six->width + term->cell_width - 1) / term->cell_width; + } + verify_sixels(term); + + term->grid = g; +} + +void sixel_unhook(struct terminal *term) { int pixel_row_idx = 0; @@ -16,6 +16,7 @@ void sixel_destroy_all(struct terminal *term); void sixel_scroll_up(struct terminal *term, int rows); void sixel_scroll_down(struct terminal *term, int rows); +void sixel_cell_size_changed(struct terminal *term); /* * Remove sixel data from the specified location. Used when printing * or erasing characters, and when emitting new sixel images, to |
