mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
sixel: decgri: handle a repeat count of 0, by ignoring it
This commit is contained in:
parent
eee216f5fe
commit
ae86043780
1 changed files with 11 additions and 2 deletions
13
sixel.c
13
sixel.c
|
|
@ -862,6 +862,9 @@ resize_horizontally(struct terminal *term, int new_width)
|
||||||
|
|
||||||
int alloc_height = (height + 6 - 1) / 6 * 6;
|
int alloc_height = (height + 6 - 1) / 6 * 6;
|
||||||
|
|
||||||
|
xassert(new_width > 0);
|
||||||
|
xassert(alloc_height > 0);
|
||||||
|
|
||||||
/* Width (and thus stride) change - need to allocate a new buffer */
|
/* Width (and thus stride) change - need to allocate a new buffer */
|
||||||
uint32_t *new_data = xmalloc(new_width * alloc_height * sizeof(uint32_t));
|
uint32_t *new_data = xmalloc(new_width * alloc_height * sizeof(uint32_t));
|
||||||
|
|
||||||
|
|
@ -901,6 +904,9 @@ resize_vertically(struct terminal *term, int new_height)
|
||||||
|
|
||||||
int alloc_height = (new_height + 6 - 1) / 6 * 6;
|
int alloc_height = (new_height + 6 - 1) / 6 * 6;
|
||||||
|
|
||||||
|
xassert(width > 0);
|
||||||
|
xassert(new_height > 0);
|
||||||
|
|
||||||
uint32_t *new_data = realloc(
|
uint32_t *new_data = realloc(
|
||||||
old_data, width * alloc_height * sizeof(uint32_t));
|
old_data, width * alloc_height * sizeof(uint32_t));
|
||||||
|
|
||||||
|
|
@ -1167,11 +1173,14 @@ decgri(struct terminal *term, uint8_t c)
|
||||||
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o':
|
case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o':
|
||||||
case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v':
|
case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v':
|
||||||
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}':
|
||||||
case '~':
|
case '~': {
|
||||||
sixel_add_many(term, c - 63, term->sixel.param);
|
unsigned count = term->sixel.param;
|
||||||
|
if (likely(count > 0))
|
||||||
|
sixel_add_many(term, c - 63, count);
|
||||||
term->sixel.state = SIXEL_DECSIXEL;
|
term->sixel.state = SIXEL_DECSIXEL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue