screen_draw_overlay_line accessed self->linebuf->line->cpu_cells
without ever calling linebuf_init_line on the shared view. Render
paths that initialize a stack-local Line via render_line_for_virtual_y
left the view's cpu_cells as NULL (the value set by alloc_line via
PyType_GenericAlloc), and the multicell-trim loop then dereferenced
NULL + xstart * sizeof(CPUCell), producing a SIGSEGV at a small
address (e.g. 0x1e for xstart=2). The crash was reachable any time
an IME pre-edit overlay was rendered with the cursor not in column 0
on a screen whose linebuf->line had not been re-pointed by some
unrelated prior call.
Fix by initializing the view at the overlay row on entry. Add a
test_draw_overlay_line method on Screen so the behavior can be
exercised directly from a regression test.
Bug fixes in dnd.c:
- mktempdir_in_cache: add missing 'return ans' after successful strdup
- mktempdir_in_cache (utils.py): use O_RDONLY instead of O_RDWR for directories
- remote_items allocation: use mi.num_uris instead of ds.num_mimes
- Off-by-one: uri_item_idx > changed to >= for bounds checks
- Off-by-one: entry_num > changed to >= for bounds checks
- populate_dir_entries: fix missing last entry after final null separator
- add_payload directory finalization: create directory on disk with mkdirat
- get_errno_name: add EFBIG, EISDIR, ENOSPC error codes
Test infrastructure:
- Add dnd_test_force_drag_dropped() to simulate DROPPED state
- Make notify_drag_data_ready() succeed in test mode
Comprehensive t=k tests added:
- Single file, empty file, single symlink transfer
- Chunked file transfer with m=1
- Single directory with children
- Directory with symlinks
- Multiple URIs
- Deep directory trees (breadth-first and depth-first, 3+ levels)
- Mixed file/dir/symlink at top level
- Completion signal
- Error handling (client errors, invalid state)
- DoS limits (REMOTE_DRAG_LIMIT, PRESENT_DATA_CAP)
- Invalid input (bad base64, too large chunks, invalid indices/handles)
- URI list with comments
- Multiple chunks for directory listing
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/9da0bff7-6a1a-490f-a4c5-8cb328e056ce
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
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
- dnd.c: drop_send_dir_listing now uses drop_append_request_keys (echoes
all request keys including Y for sub-dirs) and emits :X=handle instead
of :Y=handle:X=2. Directory handles are now the X value itself.
- dnd.c: drop_alloc_dir_handle starts handle counter at 1 so first
handle is 2, keeping 0 (absent) and 1 (symlink) reserved as per protocol.
- dnd.py: add is_dir_event() / dir_handle() helpers; update all tests to
use int(X) > 1 as directory indicator and X as the handle value.
- dnd.py: rename test_Y_key_in_dir_listing_response to
test_X_key_is_handle_in_dir_listing_response with updated assertions.
- dnd.py: test_uri_directory_transfer_tree expanded to verify unambiguous
identification (Y=parent, x=entry echoed) at all three directory levels.
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/6973699c-a979-4d97-8213-1a4a501044a1
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
- Add 37 new tests covering the drag source side of the DND protocol
- Test drag offer registration/unregistration (t=o, t=O)
- Test drag MIME type offering with various operations (copy/move/both)
- Test pre-sent data for valid/invalid indices, chunked data, multiple MIMEs
- Test image thumbnails: valid RGBA/RGB, invalid formats, dimensions, chunking
- Test drag start failures (no window, no offer, image size mismatches)
- Test drag cancellation from client (t=E:y=-1)
- Test offer replacement, cleanup, and error propagation
- Test client_id propagation for drag operations
- Test resource cleanup on window close during drag build
- Fix double-free in drag_free_built_data: set ds.items=NULL after free
- Add drag_free_offer to destroy_fake_window_contents for proper cleanup
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/f9868553-29a2-48c4-85c2-b6b8f686dccc
Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
Users who define action_alias or kitten_alias in kitty.conf had no way
to discover or trigger these custom commands from the command palette.
Aliased keybindings were miscategorized (landing in "Miscellaneous"
with no help text), and combine bindings had the same problem.
Changes:
- Resolve aliases via opts.alias_map to get correct action names,
categories, and help text for aliased keybindings
- Add dedicated "Action aliases" and "Kitten aliases" sections that
list all user-defined aliases, with bound aliases showing their key
and unbound aliases browsable as unmapped entries
- Add a "Combined actions" section for combine keybindings
- Make alias names searchable in the Go TUI so users can find
bindings by typing the alias name
- Fix action column highlight positions to match the scored text,
preventing visual corruption when searching for alias names
Also refactors collect_keys_data into focused single-responsibility
functions and reduces nesting depth across both Python and Go.