sixel: fix regression for DECGRI with a repeat count of 0

This commit is contained in:
CismonX 2023-07-11 00:51:32 +08:00
parent 7fa4a36c08
commit dbee099eeb
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

12
sixel.c
View file

@ -1703,7 +1703,11 @@ decgri_generic(struct terminal *term, uint8_t c)
} }
case '?' ... '~': { case '?' ... '~': {
const unsigned count = term->sixel.repeat_count; unsigned count = term->sixel.repeat_count;
if (unlikely(count == 0)) {
count = 1;
}
sixel_add_many_generic(term, c - 63, count); sixel_add_many_generic(term, c - 63, count);
term->sixel.state = SIXEL_DECSIXEL; term->sixel.state = SIXEL_DECSIXEL;
break; break;
@ -1722,7 +1726,11 @@ static void
decgri_ar_11(struct terminal *term, uint8_t c) decgri_ar_11(struct terminal *term, uint8_t c)
{ {
if (likely(c >= '?' && c <= '~')) { if (likely(c >= '?' && c <= '~')) {
const unsigned count = term->sixel.repeat_count; unsigned count = term->sixel.repeat_count;
if (unlikely(count == 0)) {
count = 1;
}
sixel_add_many_ar_11(term, c - 63, count); sixel_add_many_ar_11(term, c - 63, count);
term->sixel.state = SIXEL_DECSIXEL; term->sixel.state = SIXEL_DECSIXEL;
} else } else