Merge branch 'master' into pedicured

This commit is contained in:
txf 2026-01-28 19:35:59 +01:00
commit 470b900092
4 changed files with 49 additions and 6 deletions

View file

@ -122,8 +122,14 @@
* Crash when reverse-scrolling (terminfo capability `rin`) such that
the current viewport ends up outside the scrollback ([#2232][2232]).
* Regression: visual glitches in rare circumstances.
* Key release events for shortcuts being sent to the client
application (kitty keyboard protocol only) ([#2257][2257]).
* Crash when application emits sixel RA with a height of 0, a width >
0, and then starts writing sixel data ([#2267][2267]).
[2232]: https://codeberg.org/dnkl/foot/issues/2232
[2257]: https://codeberg.org/dnkl/foot/issues/2257
[2267]: https://codeberg.org/dnkl/foot/issues/2267
### Security

44
input.c
View file

@ -120,10 +120,14 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SCROLLBACK_UP_MOUSE:
if (term->grid == &term->alt) {
if (term->alt_scrolling)
if (term->alt_scrolling) {
alternate_scroll(seat, amount, BTN_BACK);
} else
cmd_scrollback_up(term, amount);
return true;
}
} else {
cmd_scrollback_up(term, amount);
return true;
}
break;
case BIND_ACTION_SCROLLBACK_DOWN_PAGE:
@ -149,10 +153,14 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SCROLLBACK_DOWN_MOUSE:
if (term->grid == &term->alt) {
if (term->alt_scrolling)
if (term->alt_scrolling) {
alternate_scroll(seat, amount, BTN_FORWARD);
} else
return true;
}
} else {
cmd_scrollback_down(term, amount);
return true;
}
break;
case BIND_ACTION_SCROLLBACK_HOME:
@ -535,7 +543,7 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_SELECT_QUOTE:
selection_start(
term, seat->mouse.col, seat->mouse.row, SELECTION_QUOTE_WISE, false);
break;
return true;
case BIND_ACTION_SELECT_ROW:
selection_start(
@ -1597,6 +1605,9 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (released)
stop_repeater(seat, key);
if (pressed)
seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
bool should_repeat =
pressed && xkb_keymap_key_repeats(seat->kbd.xkb_keymap, key);
@ -1698,6 +1709,7 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (bind->k.sym == raw_syms[i] &&
execute_binding(seat, term, bind, serial, 1))
{
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
@ -1711,6 +1723,7 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
bind->mods == (mods & ~consumed) &&
execute_binding(seat, term, bind, serial, 1))
{
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
@ -1726,12 +1739,31 @@ key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
if (code->item == key &&
execute_binding(seat, term, bind, serial, 1))
{
seat->kbd.last_shortcut_sym = sym;
goto maybe_repeat;
}
}
}
}
if (released && seat->kbd.last_shortcut_sym == sym) {
/*
* Don't process a release event, if it corresponds to a
* triggered shortcut.
*
* 1. If we consumed a key (press) event, we shouldn't emit an
* escape for its release event.
* 2. Ignoring the incorrectness of doing so; this also caused
* us to reset the viewport.
*
* Background: if the kitty keyboard protocol was enabled,
* then the viewport was instantly reset to the bottom, after
* scrolling up.
*/
//seat->kbd.last_shortcut_sym = XKB_KEYSYM_MAX + 1;
goto maybe_repeat;
}
/*
* Keys generating escape sequences
*/

View file

@ -1559,6 +1559,9 @@ resize(struct terminal *term, int new_width_mutable, int new_height_mutable)
new_height_mutable = term->sixel.max_height;
}
if (unlikely(new_height_mutable == 0)) {
new_height_mutable = 6 * term->sixel.pan;
}
uint32_t *old_data = term->sixel.image.data;
const int old_width = term->sixel.image.width;

View file

@ -151,6 +151,8 @@ struct seat {
bool alt;
bool ctrl;
bool super;
xkb_keysym_t last_shortcut_sym;
} kbd;
/* Pointer state */