Kittens can opt in with Loop.DetailedWheelEvents(), after which scroll
events arrive as MOUSE_WHEEL mouse events whose Wheel field has the
deltas, unit, multiplier, source, phase and momentum/inverted flags.
WheelEvent.Lines() converts the deltas to lines using the terminal's
multiplier when available.
The mouse-demo kitten uses this to move a block drawn with the graphics
protocol up and down with pixel precision, falling back to wheel button
presses in terminals without support, and shows the event details.
- Parse in-band resize reports robustly: require the 48; prefix, accept
extra parameters and reject negative values instead of panicking
- Handle bracketed paste in parse_input_from_terminal with a dedicated
scan for the end of paste marker so pasted escape bytes are never lost
- Guard against NaN in scroll_by_pixels and scroll_to_absolute, clamp
negative absolute scroll targets, let infinite fractional scrolls clamp
and propagate overflow errors from PyLong_AsDouble
- Empty disk cache entries no longer claim offset 0 in the cache file and
defrag only moves entries actually written to disk
- Reject zero and too large block sizes in rsync signature headers
- Only replace the encryptor tag once it has been read successfully
Always do a roundtrip at kitten exit, except for special purpose
kittens. This slows down exit by one round trip time (capped at 2
seconds), however it ensures that we never get terminal response leak.
Fixes#9839
Add --allow-fallback option to the map command that controls shifted
and ascii (alternate_key) fallback for individual key mappings.
For non-Latin keyboard layouts, when the current layout key is
non-ascii (codepoint > 127 and < 0xE000), the alternate_key from
the base layout is used for matching if the mapping opts in via
--allow-fallback=shifted,ascii.
Default kitty bindings use --allow-fallback=shifted,ascii so they
work out of the box with non-Latin layouts. User custom mappings
default to --allow-fallback=shifted (preserving existing shifted_key
behavior without ascii fallback).
--allow-fallback=none disables all fallback for a mapping.
Python side: parse_options_for_map() in options/utils.py handles flag
parsing, ShortcutMapping uses it in __init__. get_shortcut() filters
candidates by per-mapping allow_fallback.
Go side: ParseMap() handles --allow-fallback, KeyAction stores
AllowFallback, ShortcutTracker.Match passes it to matching.
MatchesParsedShortcut defaults to shifted,ascii for hardcoded shortcuts.
Migrated kittens (themes, command_palette, diff, choose_files) to
use ShortcutTracker with configurable map entries.
Tests added for Python (5 test methods) and Go (ParseMap + key matching).
Explicitly turn off in-band resize notifications if they were requested
as part of the loop. Kitty implicitly resets this mode when `XTRESTORE`
(`CSI ? r`) is seen, however some terminals implementing mode 2048
(eg foot and Ghostty) follow the xterm behavior of only restoring the
state of explicitly passed modes.
Some of the kittens have become very useful outside of just Kitty
(`show-key`, for example). Add an explicit reset of mode 2048 to support
the behavior of other terminal emulators.