aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-13 17:44:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-13 17:47:16 +0000
commitd482bf0a304b8224499bf9de9e0781518106ec7c (patch)
treeafc68b49ecaa21a3f1d5a089cfa5a7b18a95d654 /terminal.c
parentinput: maximize: unset fullscreen before toggling maximized state (diff)
sixel: improve handling of images when reflowing the grids
Update the sixels' 'row' attribute when re-flowing a grid, to ensure it is rendered at the correct place. This should work in most cases, but will break when the cell size has changed (e.g. font size increase/decrease, or a DPI change). This patch also moves the sixel image list from the terminal struct into the grid struct. The sixels are per-grid after all.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/terminal.c b/terminal.c
index 2a742268..35e145a7 100644
--- a/terminal.c
+++ b/terminal.c
@@ -721,8 +721,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
.start = {-1, -1},
.end = {-1, -1},
},
- .normal = {.damage = tll_init(), .scroll_damage = tll_init()},
- .alt = {.damage = tll_init(), .scroll_damage = tll_init()},
+ .normal = {.damage = tll_init(), .scroll_damage = tll_init(), .sixel_images = tll_init()},
+ .alt = {.damage = tll_init(), .scroll_damage = tll_init(), .sixel_images = tll_init()},
.grid = &term->normal,
.meta = {
.esc_prefix = true,
@@ -747,7 +747,6 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
.sixel = {
.palette_size = SIXEL_MAX_COLORS,
},
- .sixel_images = tll_init(),
.hold_at_exit = conf->hold_at_exit,
.shutdown_cb = shutdown_cb,
.shutdown_data = shutdown_data,
@@ -978,9 +977,12 @@ term_destroy(struct terminal *term)
tll_free(term->ptmx_buffer);
tll_free(term->tab_stops);
- tll_foreach(term->sixel_images, it)
+ tll_foreach(term->normal.sixel_images, it)
sixel_destroy(&it->item);
- tll_free(term->sixel_images);
+ tll_free(term->normal.sixel_images);
+ tll_foreach(term->alt.sixel_images, it)
+ sixel_destroy(&it->item);
+ tll_free(term->alt.sixel_images);
free(term->foot_exe);
free(term->cwd);
@@ -1104,9 +1106,12 @@ term_reset(struct terminal *term, bool hard)
term->meta.esc_prefix = true;
term->meta.eight_bit = true;
- tll_foreach(term->sixel_images, it)
+ tll_foreach(term->normal.sixel_images, it)
+ sixel_destroy(&it->item);
+ tll_free(term->normal.sixel_images);
+ tll_foreach(term->alt.sixel_images, it)
sixel_destroy(&it->item);
- tll_free(term->sixel_images);
+ tll_free(term->alt.sixel_images);
if (!hard)
return;