Commit Graph

9376 Commits

Author SHA1 Message Date
Kovid Goyal
4c6f7ff6b5 Modify drop protocol to allow transmission of broken symlinks in the URI list 2026-04-23 12:36:22 +05:30
Kovid Goyal
3cf037d263 More work on the dnd kitten 2026-04-23 12:04:05 +05:30
Kovid Goyal
bc87946a78 ... 2026-04-21 20:15:21 +05:30
Kovid Goyal
827b4b9e02 Option to have focus_follows_mouse only on drops
Fixes #9896
2026-04-21 20:05:00 +05:30
Kovid Goyal
d0a6b5eeac Implement writing of MIME data on drop 2026-04-21 13:32:02 +05:30
Kovid Goyal
9a011dea3e More work on DnD kitten 2026-04-21 08:19:22 +05:30
Kovid Goyal
01e453a048 More work on DnD kitten 2026-04-20 20:16:02 +05:30
Kovid Goyal
a899d24b64 More work on DnD kitten 2026-04-20 19:19:51 +05:30
Kovid Goyal
54eab02709 Add tests for drop move events 2026-04-20 11:23:49 +05:30
Kovid Goyal
fcb260bdfa Sort imports 2026-04-19 21:53:09 +05:30
Kovid Goyal
04fcac72ec Update minimum python to 3.11 from 3.10
3.10 is failing in CI and I cant be arsed to figure out why. It's anyway
a few months from EOL
2026-04-19 21:41:58 +05:30
Kovid Goyal
0ddbffdf79 Allow mocking remote clients 2026-04-19 20:42:43 +05:30
Kovid Goyal
51b0e9c4ad Work on testing infrastructure for DnD kitten 2026-04-19 20:21:55 +05:30
Kovid Goyal
5558dfa953 Move dnd escape code encoding into dnd.c 2026-04-19 13:48:35 +05:30
Kovid Goyal
dc9bf889a6 Fix chunking of t=k not handling metadata present only on first chunk 2026-04-19 12:52:00 +05:30
Kovid Goyal
8e76a62815 Show error message when save_as_session has too many path arguments 2026-04-18 23:15:01 +05:30
distsystem
875ca70a55 Fix crash in overlay line drawing on uninitialized linebuf view
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.
2026-04-18 13:10:07 +08:00
Kovid Goyal
e9f3844f64 Implement auto reload of config 2026-04-16 14:41:29 +05:30
copilot-swe-agent[bot]
09e10fea85 Fix stale is_selected buffer after screen buffer toggle (#9725)
When toggling between alt and main screen buffers, the selection buffer
(is_selected) was not always re-uploaded to the GPU. This caused a size
mismatch because render_lines_for_screen depends on pixel_scroll_enabled,
which depends on linebuf == main_linebuf.

On alt screen, pixel_scroll is disabled so render_lines = screen->lines.
On main screen, pixel_scroll is enabled so render_lines = screen->lines + 1.
After switching from alt to main, the cell data buffer was re-uploaded with
the larger size (is_dirty = true), but the selection buffer was not
(screen_is_selection_dirty could return false if no selections/urls/extra
cursors were active). The extra row of cells then read out-of-bounds from
the selection buffer, getting garbage data that the shader interpreted as
extra cursor shapes, producing blinking cursor-colored artifacts.

Fix by unconditionally setting extra_cursors.dirty = true after screen
toggle, ensuring the selection buffer is always re-uploaded with the
correct size matching the cell data buffer.

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/daa73124-4795-4389-aea5-bb5593a26d9f

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-16 03:13:25 +00:00
copilot-swe-agent[bot]
a348cabe23 Skip generation increment in background_images() when paths unchanged 2026-04-16 08:13:14 +05:30
Kovid Goyal
12a87929c6 Fix various minor bugs in the multiple bgimage code 2026-04-15 23:02:11 +05:30
Kovid Goyal
df4d3218a3 ... 2026-04-15 22:43:48 +05:30
Kovid Goyal
2c9541cf21 Allow preloading multiple background images to GPU for fast switching
Fixes #9836
2026-04-15 22:34:20 +05:30
Kovid Goyal
92262ca095 Merge branch 'feat/ls-tab-activity' of https://github.com/muchzill4/kitty 2026-04-15 17:37:25 +05:30
Bartek Mucha
0aa5d32f5f Don't replicate data on tabs 2026-04-15 12:59:04 +01:00
Bartek Mucha
f711e55a22 Expose window activity state in the kitty @ ls 2026-04-15 09:54:24 +01:00
Kovid Goyal
fc1a17062e ... 2026-04-15 10:11:39 +05:30
Kovid Goyal
b24425a1fd ... 2026-04-15 08:04:02 +05:30
Kovid Goyal
f65438d6a5 Improve performance of using active process data when rendering the tab bar by only scanning processes once per second
We dont bother with configurable ttl. Instead treat the start of caching
as the instant when cache freshness is checked. And ensure that cache is
re-used for every OS Window.

Fixes #9862
Fixes #9872
2026-04-15 07:53:09 +05:30
copilot-swe-agent[bot]
48523efc7f Add null check for strdup in dnd_test_drag_notify
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/3c7e550c-e8e8-413e-a54b-87d61cb8e574

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-14 09:37:36 +00:00
copilot-swe-agent[bot]
e8e2b31182 Fix memory safety issues, protocol bugs, and add tests for DnD implementation
Fixes:
- Memory leak: drag_free_remote_item now frees children array
- Memory leak: drag_free_offer now frees pending data
- Memory leak: toplevel_data_for_drag frees old URI string before replacement
- Protocol bug: drag_notify missing OSC prefix in escape code output
- Protocol bug: drag_notify missing colon separators between metadata keys
- Buffer overflow: add_payload symlink case ensures capacity for null terminator
- Integer overflow: expand_rgb_data uses size_t casts for multiplication
- Memory leak: realloc anti-pattern fixed in 7 locations (drop_register_window,
  drop_dispatch_data, drag_add_mimes, drag_add_pre_sent_data, drag_add_image,
  add_payload default case, queue_payload_to_child)
- UB: queue_payload_to_child guards memcpy with NULL source + 0 count

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/3c7e550c-e8e8-413e-a54b-87d61cb8e574

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-14 09:33:23 +00:00
Kovid Goyal
e455b29a85 Ensure tmpdir used for remote drag is deleted on kitty exit 2026-04-14 11:27:55 +05:30
copilot-swe-agent[bot]
efb4eeab50 move DnD testing infrastructure from glfw.c to dnd.c, add init_dnd()
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/78192f4b-c0b7-4c34-9073-4ea717b531da

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-14 02:12:18 +00:00
Kovid Goyal
6218a09a5b DRYer 2026-04-13 21:50:58 +05:30
copilot-swe-agent[bot]
519fd49ce6 Fix bugs in t=k remote drag implementation and add comprehensive tests
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>
2026-04-13 15:54:34 +00:00
copilot-swe-agent[bot]
2018f8b134 Fix 4 bugs in t=k implementation and add test infrastructure
Bug 1: remote_items allocation used ds.num_mimes instead of mi.num_uris
Bug 2: Off-by-one in uri_item_idx > mi.num_uris (should be >=)
Bug 3: Off-by-one in entry_num > parent->children_sz (should be >=)
Bug 4: DRAG_SOURCE_DROPPED state never set in drag_notify

Also add dnd_test_force_drag_dropped() helper and make
notify_drag_data_ready() succeed in test mode.

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/9da0bff7-6a1a-490f-a4c5-8cb328e056ce

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-13 15:21:20 +00:00
Kovid Goyal
6bd41c94a2 Make the data transfer limits mutable for use in testing 2026-04-13 20:20:25 +05:30
Kovid Goyal
4942ac98a1 More work on DnD protocol 2026-04-13 19:40:23 +05:30
Kovid Goyal
5d2dea4a62 Re-organise code 2026-04-12 14:46:29 +05:30
Kovid Goyal
864ef70484 Have the client send machine id to terminal rather than vice versa
The terminal is the trusted by user party here.
2026-04-12 11:00:23 +05:30
Kovid Goyal
9ebe692bf7 Allow drop clients to use machine id as well 2026-04-12 09:27:16 +05:30
Kovid Goyal
88a4d90daa ... 2026-04-11 22:05:01 +05:30
Kovid Goyal
e53bad9fc2 More work on DnD protocol 2026-04-11 21:52:07 +05:30
Kovid Goyal
36237f3bd0 Cleanup previous PR 2026-04-11 20:46:11 +05:30
copilot-swe-agent[bot]
f6b999efdd Implement parse_uri_list() in dnd.c per RFC 2483
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/06c06ea3-b5d0-4f78-b319-380af08bb139

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-11 15:07:08 +00:00
Kovid Goyal
aa57cef9ed More work on DnD protocol 2026-04-11 20:26:38 +05:30
Kovid Goyal
ba95be8303 More work on DnD protocol 2026-04-11 19:45:03 +05:30
Kovid Goyal
df20d4aa7c Add machine id and stub for t=k transfers 2026-04-11 17:20:53 +05:30
copilot-swe-agent[bot]
74c3bbe06d Implement software rendering for Unicode 16 legacy computing symbols
Add rendering for codepoints U+1FBCE-U+1FBEF, U+1CC1B-U+1CC3F,
and U+1CE16-U+1CE19 in decorations.c with registration in fonts.c
and test coverage in kitty_tests/fonts.py.

Characters implemented:
- U+1FBCE-1FBCF: Left two-thirds and one-third blocks
- U+1FBD0-1FBDF: 16 diagonal box drawing characters
- U+1FBE0-1FBE3: Justified half white circles (outlines)
- U+1FBE4-1FBE5: Upper/lower centre quarter blocks
- U+1FBE8-1FBEB: Justified half black circles (filled)
- U+1FBEC-1FBEF: Justified quarter black circles (filled)
- U+1CC1B-1CC1E: Box drawing variants with offset junctions
- U+1CC1F-1CC20: Double diagonal lines
- U+1CC30-1CC3F: Twelfth and quarter circle arcs
- U+1CE16-1CE19: Box drawings light vertical T-junctions

Fixes #9851
2026-04-11 14:17:21 +05:30
copilot-swe-agent[bot]
5f01076daa Fix comment in draw_separated_block
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/0e5a33d1-c34e-4e8a-b161-7469ab770c05

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-11 04:28:28 +00:00