aboutsummaryrefslogtreecommitdiff
path: root/sixel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sixel.c')
-rw-r--r--sixel.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sixel.c b/sixel.c
index 187f1348..1db6336d 100644
--- a/sixel.c
+++ b/sixel.c
@@ -2207,9 +2207,11 @@ sixel_geometry_reset(struct terminal *term)
void
sixel_geometry_set(struct terminal *term, unsigned width, unsigned height)
{
- LOG_DBG("sixel geometry set to %ux%u", width, height);
- term->sixel.max_width = width;
- term->sixel.max_height = height;
+ const unsigned new_width = min(width, SIXEL_MAX_WIDTH);
+ const unsigned new_height = min(height, SIXEL_MAX_HEIGHT);
+ LOG_DBG("sixel geometry set to %ux%u", new_width, new_height);
+ term->sixel.max_width = new_width;
+ term->sixel.max_height = new_height;
sixel_geometry_report_current(term);
}