summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2022-02-10 21:07:24 +0100
committerChristian Persch <chpe@src.gnome.org>2022-02-10 21:07:24 +0100
commit5fa45b4b177989d35fad927e9f8f9d57d4dbba2a (patch)
treed8a0cc879854a08afe3b24669cd321598a71e32a
parentedaca046502c02a4b2e247bebae3f69f3ecb6ebd (diff)
downloadvte-5fa45b4b177989d35fad927e9f8f9d57d4dbba2a.tar.gz
sixel: Fix DECGRI for parameter value 0
A DECGRI 0 should be treated like a DECGRI 1, as per DEC documentation. Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2543
-rw-r--r--src/sixel-context.hh5
-rw-r--r--src/sixel-test.cc8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/sixel-context.hh b/src/sixel-context.hh
index 60114991..264f3046 100644
--- a/src/sixel-context.hh
+++ b/src/sixel-context.hh
@@ -533,14 +533,17 @@ private:
* args[0]: 1
*
* References: DEC PPLV2 ยง 5.8
+ * DEC STD 070
*/
/* DEC terminals limited the repetition count to 255, but the SIXEL
* test data includes repeat counts much greater. Since we limit to
* k_max_width anyway when executing the repeat on the next sixel,
* don't limit here.
+ *
+ * A repeat count of 0 is treated like 1.
*/
- m_repeat_count = seq.param(0, 1);
+ m_repeat_count = seq.param(0, 1) ? : 1;
}
void
diff --git a/src/sixel-test.cc b/src/sixel-test.cc
index 3f9fd312..adc7cbac 100644
--- a/src/sixel-test.cc
+++ b/src/sixel-test.cc
@@ -1340,6 +1340,14 @@ test_context_repeat(void)
g_assert_cmpuint(*data++, ==, v);
g_assert_cmpuint(size_t(data - pixels.get()), <=, size);
+
+ /* Check that repeat param 0 is trated as 1 */
+ parse_image(context, {DECGRI(0), Sixel(1u << 0)});;
+ assert_image_dimensions(context, 1, 1);
+
+ /* Check that omitted param is treated as default */
+ parse_image(context, {DECGRI(-1), Sixel(1u << 0)});
+ assert_image_dimensions(context, 1, 1);
}
static void