aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-14 13:41:34 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-21 10:57:24 +0000
commitacb3f1cd10213b95d9fc1b8f1010e105d5ebab9f (patch)
tree058c658e946ecf189bc9d333de994995435022a1
parentreadme: add IME to the feature list (diff)
sixel: current geometry: don’t exceed current window dimensions
This is similar to what XTerm does, and fixes an issue with lsix, where the output did not wrap.
-rw-r--r--CHANGELOG.md2
-rw-r--r--sixel.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e16ab80..8acc6666 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,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",