From 5efd34c3c408602544e9884954316638b32c2c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 14 Jan 2021 14:41:34 +0100 Subject: [PATCH] =?UTF-8?q?sixel:=20current=20geometry:=20don=E2=80=99t=20?= =?UTF-8?q?exceed=20current=20window=20dimensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is similar to what XTerm does, and fixes an issue with lsix, where the output did not wrap. --- CHANGELOG.md | 2 ++ sixel.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24e6dfe2..4245280e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,8 @@ * Pasting URIs from the clipboard when the source has not newline-terminated the last URI (https://codeberg.org/dnkl/foot/issues/291). +* Sixel “current geometry” query response not being bounded by the + current window dimensions (fixes `lsix` output) ### Security diff --git a/sixel.c b/sixel.c index bf06ef3e..cfca4d4a 100644 --- a/sixel.c +++ b/sixel.c @@ -1145,7 +1145,8 @@ sixel_geometry_report_current(struct terminal *term) { char reply[64]; snprintf(reply, sizeof(reply), "\033[?2;0;%u;%uS", - term->sixel.max_width, term->sixel.max_height); + min(term->cols * term->cell_width, term->sixel.max_width), + min(term->rows * term->cell_height, term->sixel.max_height)); term_to_slave(term, reply, strlen(reply)); LOG_DBG("query response for current sixel geometry: %ux%u",