Commit graph

2090 commits

Author SHA1 Message Date
Forrest
83677a2235 fix(choose-fonts): guard preview rendering against partial terminal color query
The choose-fonts kitten queries the terminal for the user's foreground and
background colors at startup by sending a DCS request. The terminal responds
with separate DCS response strings — one per field — which arrive
asynchronously through on_query_response.

The background handler unconditionally called draw_screen() after storing its
value. If the terminal's DCS response for "background" arrived before the
response for "foreground", draw_screen() fired with text_style.Foreground
still at its Go zero value ("").

The font list preview (list.go) only guarded against empty Background, not
empty Foreground, so it passed the check and sent a render_family_samples
command to the Python backend with foreground="". The backend's to_color('')
raised ValueError: Invalid color name: '', crashing the kitten.

The faces pane (faces.go) launched a render_family_samples goroutine
unconditionally when its preview cache was empty, with no guard at all.

Fix
---
1. ui.go — Only trigger draw_screen() from the foreground or background
   handler when the counterpart field is already populated, so the UI
   never renders with a partial TextStyle.

2. list.go — Require both Foreground and Background to be non-empty
   before rendering the font preview, not just Background alone.

3. faces.go — Skip the render_family_samples goroutine if either color
   field is still empty. The preview cache stays empty, so the next
   redraw (triggered when the counterpart query response arrives, or
   by on_wakeup) retries with full colors.
2026-06-10 02:18:18 -07:00
Kovid Goyal
45bd3a0f14
Add a note about interaction of --reload-in and auto reload 2026-06-07 08:55:48 +05:30
Kovid Goyal
8996aa798c
dnd kitten: Create regular files with O_EXCL to avoid symlink attacks
Some checks failed
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Has been cancelled
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Has been cancelled
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Has been cancelled
CI / Linux package (push) Has been cancelled
CI / Bundle test (macos-latest) (push) Has been cancelled
CI / Bundle test (ubuntu-latest) (push) Has been cancelled
CI / macOS Brew (push) Has been cancelled
CI / Test ./dev.sh and benchmark (push) Has been cancelled
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, macos-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Has been cancelled
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Has been cancelled
Depscan / Scan dependencies for vulnerabilities (push) Has been cancelled
This is not really needed as the terminal emulator should be de
duplicating directory entries anyway but no harm in defense in depth.
2026-06-03 12:17:38 +05:30
Kovid Goyal
e6e5524f67
diff kitten: Strip suid/sgid bits from extracted files 2026-06-03 05:45:04 +05:30
Connor Welsh
d50d1bba65
ssh kitten: avoid in-place mutation of cmd by slices.Insert
slices.Insert(cmd, 1, "-O", "check") writes into cmd's backing array
when there is spare capacity (cap(cmd) >= len(cmd)+2). check_cmd points
at the shifted array, but cmd's slice header is unchanged: reading
cmd[:insertion_point] later returns "-O", "check", ... where the
original prefix used to be. run_control_master, forward_remote_control,
and the final ssh exec all build their argvs from this corrupted prefix.

Repro: share_connections=yes, forward_remote_control=yes, and enough
ssh_args to push cmd past Go's slice-growth threshold (kitten ssh -v
host does it). With the ControlMaster already up you'll see
"Multiplexing command already specified"; otherwise it fails with
"Failed to start SSH ControlMaster" and a stray -O check left in the
cmdline.
2026-05-18 23:08:33 -04:00
copilot-swe-agent[bot]
858c453ae9
Simplify message formatting in render.go
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/84513fee-68de-4504-b41b-e8643e0ea585

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-18 08:46:34 +00:00
copilot-swe-agent[bot]
7af3f4ee83
Refactor dnd kitten: track num_dropped_files instead of data_has_been_dropped
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/84513fee-68de-4504-b41b-e8643e0ea585

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-18 08:44:07 +00:00
Kovid Goyal
6da5bae945
Cleanup previous PR 2026-05-18 13:55:48 +05:30
copilot-swe-agent[bot]
9bb33ac25a
Address code review: clarify comments and simplify mime stripping
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/dd371733-fa08-484e-888a-8d0ebdadb853

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-18 07:59:00 +00:00
copilot-swe-agent[bot]
d5a6c072d9
Add data URI support to dnd kitten parse_uri_list
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/dd371733-fa08-484e-888a-8d0ebdadb853

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-18 07:54:57 +00:00
Kovid Goyal
2a59bfe9a0
Dont request the same MIME type multiple times 2026-05-18 13:08:49 +05:30
Kovid Goyal
32e6e834a6
Some cleanups 2026-05-18 11:14:11 +05:30
Kovid Goyal
b881ed6580
Handle small reads from files correctly 2026-05-17 13:50:41 +05:30
Kovid Goyal
a1b1b89feb
macOS requires URLs to directories to end with a slash 2026-05-17 08:38:11 +05:30
copilot-swe-agent[bot]
8acb6e7ecb
Address review comments: rename variable and improve comments
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:53:15 +00:00
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
9b27f095c8
A couple more places to expand ~ 2026-05-14 06:21:07 +05:30
Kovid Goyal
a771b1d7e5
Expand ~ when processing args for dnd kitten
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-05-14 06:13:53 +05:30
gogongxt
56f276580f Fix hints kitten breaking multi-byte UTF-8 characters when overlaying hint labels
In highlight_mark(), mark_text was sliced using byte-based indexing
(mark_text[:len(hint)] and mark_text[len(hint):]). Since len(hint)
equals the rune count (hint is always ASCII), but len(mark_text) is a
byte count, this could slice in the middle of a multi-byte UTF-8
sequence (e.g. CJK characters), producing an invalid byte sequence
rendered as the Unicode replacement character (�).

Fix by converting mark_text to []rune first, then slicing at rune
boundaries. The hint is ASCII so len(hint) == rune count, requiring
no conversion on the hint side.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 17:09:42 +08:00
Kovid Goyal
b9261c4e26
Fix failing test
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Ensure we never write empty payloads for symlinks/dir listings
2026-05-12 12:52:04 +05:30
Kovid Goyal
2bda489698
Clear remote_item_write_id on completion
Needed as send next remote item checks it is zero before sending
2026-05-12 12:39:34 +05:30
Kovid Goyal
02cfa89bae
... 2026-05-11 21:59:45 +05:30
Kovid Goyal
634f13e65f
More work on dnd kitten 2026-05-11 21:51:23 +05:30
Kovid Goyal
0cddb39d95
More work on dnd kitten 2026-05-08 22:23:29 +05:30
Kovid Goyal
5de8734ce3
choose-files kitten: Output a trailing newline when writing to a tty in text format
Fixes #9982
2026-05-07 08:53:09 +05:30
Kovid Goyal
fb7b5d7155
Turn on mouse tracking so text is not selected in the dnd kitten 2026-05-06 17:22:19 +05:30
Kovid Goyal
5ec8c52025
... 2026-05-06 12:15:08 +05:30
Kovid Goyal
e024f33b70
... 2026-05-06 08:53:23 +05:30
Kovid Goyal
247ac6df59
Drag source delete on drop should only be done for remote drops 2026-05-05 21:49:42 +05:30
Kovid Goyal
c224fae023
Merge branch 'copilot/delete-files-on-drag-drop' of https://github.com/kovidgoyal/kitty 2026-05-05 21:47:44 +05:30
copilot-swe-agent[bot]
6129fd66b3
Delete source files on move drag, clear drag_sources and allow_drags
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/2f6384ba-c55a-4842-83a9-4cf1b0937420

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-05 16:10:19 +00:00
Kovid Goyal
f7c8fe9c78
flag to track if a drag source sends remote data 2026-05-05 21:39:42 +05:30
copilot-swe-agent[bot]
13898e73f2
Implement --exit-on flag for dnd kitten
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/b6835902-79c3-4d14-9761-8633073db808

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-05 10:33:11 +00:00
Kovid Goyal
74787a60d7
New option to control when dnd kitten exits
To be implemented
2026-05-05 15:55:02 +05:30
Kovid Goyal
516ca9a8c4
Dont try to generate drag thumbnail from file contents as its too slow 2026-05-05 15:47:05 +05:30
copilot-swe-agent[bot]
fe6807c9b0
implement move deletion and add tests for dnd kitten drop
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/e2238746-2319-43e5-9b01-4899e7f06b50

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-05 09:37:50 +00:00
Kovid Goyal
9a3f3ed14e
... 2026-05-05 14:54:09 +05:30
Kovid Goyal
898599ff14
Use a fallback icon as drag thumbnail is none is found 2026-05-05 14:47:50 +05:30
Kovid Goyal
3165a47579
More work on the DnD kitten 2026-05-05 10:49:56 +05:30
Kovid Goyal
fd451f5974
Add flag to specify drop directory for dnd kitten 2026-05-05 09:47:12 +05:30
Kovid Goyal
2316a8ce25
More work on dnd kitten 2026-05-04 12:32:56 +05:30
Kovid Goyal
4fe29f2630
dd basic drag thumbnail support to dnd kitten 2026-05-03 22:18:18 +05:30
Kovid Goyal
ee38d3f0c8
Fix failing test 2026-05-03 18:52:54 +05:30
Kovid Goyal
7b93a9b57e
Fix double base64 encoding 2026-05-03 17:29:01 +05:30
copilot-swe-agent[bot]
c98c8542ca
Fix two bugs in remote DnD drag: missing idx_in_uri_list and stale data_capacity
Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/fdd92dca-f2f9-4bb6-9d85-b5daeaa501f7

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-05-03 07:57:06 +00:00
Kovid Goyal
0de313e178
More work on the dnd kitten 2026-05-03 13:06:56 +05:30
Kovid Goyal
a7a7a4fd8f
More work on the dnd kitten 2026-05-03 12:09:40 +05:30
Kovid Goyal
7d468cb000
More work on dnd kitten 2026-05-03 06:54:43 +05:30
Kovid Goyal
d3114ec948
More work on the dnd kitten 2026-05-02 15:18:11 +05:30
Kovid Goyal
ff7c6425e6
More work on dnd kitten 2026-05-02 12:16:42 +05:30