csi: kitty: limit pop count to the size of the flag stack

It's circular, but there's no need to walk through it more than
once...

csi: kitty: limit pop count to the size of the flag stack

It's circular, but there's no need to walk through it more than
once...
This commit is contained in:
Daniel Eklöf 2026-06-24 13:03:14 +02:00
parent 22ea71117c
commit 01b3e7ed92
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

4
csi.c
View file

@ -1769,10 +1769,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
case '<': {
switch (final) {
case 'u': {
int count = vt_param_get(term, 0, 1);
struct grid *grid = term->grid;
int count = min(vt_param_get(term, 0, 1), ALEN(grid->kitty_kbd.flags));
LOG_DBG("kitty kbd: popping %d levels of flags", count);
struct grid *grid = term->grid;
uint8_t idx = grid->kitty_kbd.idx;
for (int i = 0; i < count; i++) {