Commit graph

9485 commits

Author SHA1 Message Date
Kovid Goyal
32e6e834a6
Some cleanups 2026-05-18 11:14:11 +05:30
Kovid Goyal
0b56a8567d
Use O_EXCL with O_CREAT for drag source files 2026-05-18 08:37:50 +05:30
Kovid Goyal
092b7504de
Merge branch 'copilot/review-drag-and-drop-security' of https://github.com/kovidgoyal/kitty 2026-05-17 22:19:43 +05:30
copilot-swe-agent[bot]
0062495e96
fix drop_update_mimes: use exact MIME matching and correct sentinel value
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/c41c0c3f-f9c8-4638-a4c4-64961b030f35

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-17 16:45:07 +00:00
Kovid Goyal
ee754bac05
... 2026-05-17 22:00:22 +05:30
Kovid Goyal
26c1902e1e
... 2026-05-17 21:53:12 +05:30
Kovid Goyal
bd918569ba
Sanitize dir entry filenames 2026-05-17 21:48:52 +05:30
copilot-swe-agent[bot]
df9b906bc4
Fix review: simplify fmt and normalize conditionals in dnd_command
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/aa0821cf-6cf1-4fe5-ad76-904dba97aefa

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-17 16:00:08 +00:00
copilot-swe-agent[bot]
d6886e0ccc
Add dnd_command support to --dump-commands in client.py
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/aa0821cf-6cf1-4fe5-ad76-904dba97aefa

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-17 15:57:50 +00:00
copilot-swe-agent[bot]
05b288e754
Address code review: use PATH_MAX buffer and move os import to top
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/da8b4577-3de8-4784-afc0-c1967f605dec

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-17 15:34:56 +00:00
copilot-swe-agent[bot]
634c078168
Fix empty file not created when dragging from remote Linux to Finder
When dragging an empty file (or a directory containing an empty file)
from a remote Linux machine to macOS Finder, the empty file would not
be copied.

Root cause: in add_payload() in dnd.c, the file is only created with
O_CREAT when payload data arrives. For an empty file, no payload is
ever sent, so the file was never created on disk. When Finder then
tried to hard-link the (non-existent) temp file to the destination, it
failed silently.

Fix: in the "all data received" handler for type 0 (regular file),
check if the fd was ever opened. If not (empty file), create the empty
file explicitly before finishing.

Also add:
- A new test probe drag_remote_item_path:N to retrieve the filesystem
  path of a specific remote item by URI index.
- Two regression tests: test_remote_drag_empty_file (verifying the
  empty file is created on disk) and test_remote_drag_dir_with_empty_file
  (verifying an empty child file inside a directory is created on disk).

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/da8b4577-3de8-4784-afc0-c1967f605dec

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-17 15:31:15 +00:00
Kovid Goyal
ec8d23258c
Fix dragging folder from remote machine to Finder 2026-05-17 13:58:14 +05:30
Kovid Goyal
7e59c08fc0
Be defensive 2026-05-17 08:57:47 +05:30
Kovid Goyal
3e0850a864
Fix failing test 2026-05-17 08:52:28 +05:30
Kovid Goyal
5669df4022
Fix drag from window 1 and drop onto non dnd window 2 not working 2026-05-17 07:54:41 +05:30
Kovid Goyal
75b99a3cbf
Fix drop state update on move incorrect when transitioning between windows 2026-05-17 07:50:41 +05:30
Kovid Goyal
0fc73dd8c3
Fix extra ST being sent 2026-05-17 07:14:11 +05:30
Kovid Goyal
4584d5ce47
Code cleanup 2026-05-16 16:45:48 +05:30
Kovid Goyal
ffec9a854a
macOS: Resolve file reference URLs before using them to populate text/uri-list 2026-05-16 16:28:50 +05:30
copilot-swe-agent[bot]
66e667b096
fix: send drag leave/enter events when crossing kitty window boundaries during DnD
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/6aeadc64-7167-4cdb-bafd-8b680cef5d2d

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-16 10:29:53 +00:00
Kovid Goyal
2e8d57c1b0
Fix crash under ASAN 2026-05-16 15:46:26 +05:30
Kovid Goyal
fe4f4953fa
Fix failing tests 2026-05-15 11:56:02 +05:30
Kovid Goyal
ef6539d697
Propagate error when requesting drop data 2026-05-15 11:33:33 +05:30
Kovid Goyal
35cd3d37f2
Fix dnd from remote to finder on macOS 2026-05-15 10:00:38 +05:30
Kovid Goyal
6d4371f596
Properly pass source actions to drop events
Implemented for Wayland. Needs implementation for X11 and macOS
2026-05-14 11:07:52 +05:30
copilot-swe-agent[bot]
66dca3cde1
Fix dnd kitten: restrict drop to boxes matching drag source allowed operations
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/41b8254d-fc79-4f41-9775-67d1ddfceb5b

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-14 02:49:17 +00:00
Kovid Goyal
bfc3646868
Fix spurious drag start on initial click 2026-05-14 07:59:53 +05:30
Kovid Goyal
5064608879
Fix dragging from one kitty window to another in the same kitty instance not working 2026-05-14 07:10:57 +05:30
Kovid Goyal
afe9493990
... 2026-05-14 07:04:29 +05:30
Kovid Goyal
8b17088b58
dnd fix remote drag source premature removal of remote file data
Instead the remote data is removed from the cache on:
1) new drag start
2) window destruction
3) application exit
2026-05-13 12:35:10 +05:30
Kovid Goyal
8b85bc3440
Cleanup previous PR 2026-05-13 11:51:18 +05:30
Kovid Goyal
7cd9ba03a3
Merge branch 'read-fc-matrix' of https://github.com/Strykar/kitty 2026-05-13 11:50:13 +05:30
Kovid Goyal
572b14f994
Merge branch 'pr-single-instance-background-overrides' of https://github.com/oxysoft/kitty 2026-05-13 11:20:04 +05:30
Kovid Goyal
c2a7225657
Ensure drag finish timer doesnt fire will waiting for remote item data 2026-05-13 10:59:44 +05:30
Kovid Goyal
c909809bb4
More work on DnD kitten 2026-05-13 08:25:14 +05:30
Kovid Goyal
b28712bfae
More work on the DnD kitten 2026-05-13 07:17:06 +05:30
Kovid Goyal
b9261c4e26
Fix failing test
Ensure we never write empty payloads for symlinks/dir listings
2026-05-12 12:52:04 +05:30
Kovid Goyal
0a69b89a80
More work on dnd kitten 2026-05-12 12:23:57 +05:30
nuck
654cce687e Honor background image overrides for single instance windows 2026-05-11 18:52:04 -04:00
Kovid Goyal
f4e9824e18
Fix off by one in if condition 2026-05-11 22:06:32 +05:30
Kovid Goyal
43b028bd6a
Finish terminal side port of new dnd sub protocol 2026-05-11 13:39:43 +05:30
Kovid Goyal
07ec007388
Start work on porting code to new remote drag source protocol 2026-05-10 05:04:46 +05:30
Strykar
b3e7c3e717
Read FC_MATRIX from fontconfig
pattern_as_dict() in fontconfig.c never read FC_MATRIX, so any per-font
transform set by fontconfig was silently dropped. fontconfig ships a
default rule (90-synthetic.conf) that applies a slant matrix to any
roman-only font when italic is requested, which is why italic CJK has
been rendering upright in kitty.

Read the matrix, carry it on the descriptor as a 4-tuple of doubles,
apply it once in face_from_descriptor() via FT_Set_Transform, also
inform HarfBuzz via hb_font_set_synthetic_slant + hb_ft_font_changed
so shaping reflects the slanted rendering. Extend
face_equals_descriptor() to compare the matrix so the per-FontGroup
fallback cache returns the right face when upright and italic share a
font file.

The FT transform is sticky on the face, so subsequent FT_Load_Glyph
calls inherit it with no per-call overhead, and the per-Face glyph
atlas cache stays correct because the matrix is set at init and never
changes. Pure shears (xx=1, yy=1) preserve horizontal advance and do
not disturb monospace cell width.

The HB synthetic_slant call is gated on HB_VERSION_ATLEAST(4,0,0) since
setup.py allows down to 1.5.0. hb_ft_font_changed runs unconditionally
to invalidate any populated caches.

Refs #9857, #9700.
2026-05-10 02:48:29 +05:30
Kovid Goyal
a0da884c6a
Add optional error descriptions to drop errors as well 2026-05-09 12:24:43 +05:30
Kovid Goyal
21d8b2bcc0
Add descriptions to error codes for drag sources 2026-05-09 09:58:38 +05:30
Kovid Goyal
10efa4be76
dnd kitten: fix remote -> local on Wayland
The compositor can request data for items before dropping
2026-05-09 08:33:42 +05:30
Kovid Goyal
0cddb39d95
More work on dnd kitten 2026-05-08 22:23:29 +05:30
Kovid Goyal
744fc12ca8
Cleanup previous PR
We cant rely on is_wayland() during parsing as that can occur in offline
contexts.
2026-05-08 21:07:51 +05:30
nuck
bb7df075cf Honor OS window positions in launch paths 2026-05-08 08:06:50 -04:00
Kovid Goyal
9e8bd7207b
Track remote client on drag source items 2026-05-08 16:54:20 +05:30