Commit Graph

17458 Commits

Author SHA1 Message Date
ghostty-vouch[bot]
a36dc245b0 Sync CODEOWNERS vouch list (#13981)
Sync CODEOWNERS owners with vouch list.

## Added Users

- @ollioddi
- @rkoten
- @tuananh
- @vasilmytsyk

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-24 00:26:53 +00:00
trag1c
9f0e1719dc i18n: update bg_BG translations (#13802) 2026-08-23 18:06:12 +02:00
Mitchell Hashimoto
e424060675 libghostty: centralize pasting to ghostty_terminal_paste, enable mode 5522 (#13978)
**Note: this has no changes for Ghostty GUI yet.** This only impacts
libghostty-vt.

This introduces a new `ghostty_terminal_paste` C API along with a
central `terminal.paste.paste` function that handles (1) mode 5522
(Kitty clipboard) (2) bracketed paste (3) normal paste all in one place,
combined with unsafe value detection and proper xterm-style newline
handling.

Terminal pasting is now stateful because for the Kitty clipboard
protocol in particular, it must mint "grants" that stay with the
terminal. Previously, paste encoding was stateless.

To start, this is only exposed/used by libghostty to enable Kitty
clipboard handling.

Other changes:

- **IO: randomSecure.** This also adds the `io.randomSecure`
implementation to `TinyIo` and a global sys override for it because
Kitty clipboard requires the ability to create one-time passwords and
the implementation (following Kitty) requires a crypto random source.
The sys model is for libghostty embedders.

- **New C result value: rejected.** This introduces a new C result enum
value "rejected" for values that are valid but rejected for some reason.
Its very possible that prior "invalid value" users will have to update
to this, and I recognize that its close to both but it fills an
important semantic difference.

Also note this still _eagerly_ requires all clipboard contents. I want
to move to a callback based model but it made the PR much more
complicated. I plan on playing with that before converting apprt's to
this.
2026-08-23 07:23:30 -07:00
ghostty-vouch[bot]
5834a0e3df Update VOUCHED list (#13977)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13976#discussioncomment-18121426)
from @pluiedev.

Denounce: @tangivis

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 05:15:39 +00:00
ghostty-vouch[bot]
da0093671a Update VOUCHED list (#13975)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13899#discussioncomment-18120807)
from @jcollie.

Vouch: @j-c-m

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 03:03:08 +00:00
Mitchell Hashimoto
60a1ae2df7 libghostty: add ghostty_terminal_paste C API with paste events example 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
dda8e6f314 sys: add secure random override option with a platform default 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
8760323165 terminal: add stream handler paste operation and enable mode 5522 in libghostty 2026-08-22 15:16:30 -07:00
Mitchell Hashimoto
a5bb22e235 terminal: add shared paste core with Kitty clipboard paste events 2026-08-22 15:14:39 -07:00
Mitchell Hashimoto
da5ddcb085 terminal: Kitty drag and drop protocol drop-only core logic and state machine (#13973)
This builds out the core logic and state machine for the Kitty drag and
drop protocol for _drops only_. This hooks it into libghostty-vt's Zig
API but it isn't available to the C API and it isn't hooked up to any
Ghostty GUI. It isn't really recommended that Zig consumers integrate
this yet because I'm sure the API will continue to change dramatically
as I address the missing features: drag source, remote drops, etc.

The major thing this does it the core `src/terminal/kitty/dnd.zig` stuff
with e2e tests extracted from Kitty's own `kitty_tets/dnd.py`. So this
verifies that what we have so far is working properly.
2026-08-22 10:07:09 -07:00
Mitchell Hashimoto
db2f8be590 terminal/kitty: dnd docs 2026-08-22 09:35:13 -07:00
Mitchell Hashimoto
af8d28a940 terminal/kitty: drag and drop stream handler 2026-08-22 09:34:03 -07:00
Mitchell Hashimoto
50f69b883c terminal/kitty: drag and drop drop state machine 2026-08-22 09:33:52 -07:00
Mitchell Hashimoto
38746b8c14 terminal/kitty: drag and drop response encoding 2026-08-22 09:33:44 -07:00
Mitchell Hashimoto
7c845e8af5 terminal/kitty: drag and drop command decoding 2026-08-22 09:33:37 -07:00
Mitchell Hashimoto
3b9c4e0ddb libghostty: implement Kitty clipboard protocol read/write (#13963)
This implements the full Kitty clipboard protocol for libghostty-vt.
libghostty users need to only have the clipboard read/write effect for
this to work. This doesn't yet do mode 5522.
2026-08-22 08:50:38 -07:00
Mitchell Hashimoto
4f49dc2b8b libghostty: implement Kitty clipboard protocol reads via clipboard_read effect 2026-08-22 07:02:09 -07:00
Jeffrey C. Ollie
5851d98615 gtk: avoid physical fallback for XKB modifiers (#13967)
Hi, I noticed that this XKB config line was causing problems for
Ghosttty:

```
    key <DELE> {   [ ISO_Level3_Shift ] };
```

That's a valid reconfiguration of the "delete key" as a modifier, and
the same worked find in other terminal emulators (like Alacritty). With
Ghosttty, I was getting actual `<delete>` behaviour whenever I pressed
the modifier key (although the modifier engaged after that).

This patch fixes it. In line with your AI disclose policy: I made the
patch with Codex Sol. The logical fix is very succinct, and the bulk of
the patch works around an underlying issue to do with GDK not
recognising some modifiers as modifiers. I've tested the implementation
and the patch definitely resolves it!
2026-08-22 03:55:34 -05:00
ghostty-vouch[bot]
d03cd1f534 Update VOUCHED list (#13970)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13966#discussioncomment-18114178)
from @jcollie.

Vouch: @by-nelson

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 08:54:25 +00:00
ghostty-vouch[bot]
2021d2addb Update VOUCHED list (#13969)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13968#discussioncomment-18113956)
from @pluiedev.

Vouch: @tothedarktowercame

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 08:15:28 +00:00
Joseph Corneli
ef01d5fda7 gtk: avoid physical fallback for XKB modifiers 2026-08-22 08:39:43 +01:00
Mitchell Hashimoto
6959fd46c6 libghostty: implement Kitty clipboard protocol write only
This implements only the clipboard _write_ side of the Kitty clipboard
protocol for libghostty-vt. libghostty users don't need to do anything,
this all automatically works since it just piggy-backs on the previous
clipboard write effect.

Clipboard reading is far more complicated because we don't have anything
designed yet for libghostty-vt that does async requests (e.g. to ask the
user for permission). I need to think about that more.
2026-08-21 21:16:14 -07:00
Mitchell Hashimoto
36676c5728 libghostty: clipboard_read effect, enables OSC52 reads (#13965)
This adds a `clipboard_read` effect to the stream terminal handler and a
matching `GHOSTTY_TERMINAL_OPT_CLIPBOARD_READ` callback to the
libghostty-vt C API so that embedders can answer OSC 52 read requests
(the `?` payload).

This is a _blocking_ effect: if the embedder needs to ask the user for
permission, the entire VT processing pipeline is _blocked_ during the
callback. This is a purposeful simplification choice compared to how
Ghostty GUI works with async requests. I think its reasonable, it
eliminates a TON of complexity.

If the effect isn't set, then any clipboard reads are denied.

This can be expanded easily to support Kitty clipboard protocol later.
2026-08-21 21:10:07 -07:00
Mitchell Hashimoto
e03475c0cc libghostty: clipboard_read effect, enables OSC52 reads
This adds a `clipboard_read` effect to the stream terminal handler and a
matching `GHOSTTY_TERMINAL_OPT_CLIPBOARD_READ` callback to the
libghostty-vt C API so that embedders can answer OSC 52 read requests
(the `?` payload). 

This is a _blocking_ effect: if the embedder needs to ask the user for
permission, the entire VT processing pipeline is _blocked_ during the
callback. This is a purposeful simplification choice compared to how
Ghostty GUI works with async requests. I think its reasonable, it
eliminates a TON of complexity.

If the effect isn't set, then any clipboard reads are denied.

This can be expanded easily to support Kitty clipboard protocol later.
2026-08-21 20:51:31 -07:00
Mitchell Hashimoto
ca9e5b1301 terminal/osc: kitty notification parsing feedback 2026-08-21 14:00:30 -07:00
Jeffrey C. Ollie
073bffcff4 osc 99: eliminate unnecessary inline switch branches 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
07f33ad914 osc 99 & 5522: share metadata parsing code
Reduce redundant code by sharing the metadata parsing code
between the OSC 99 & OSC 5522 parsers.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
aa4ec3508e osc 99: address review feedback
* Fix typos.
* Eliminate metadata parsing code duplication.
* Improve documentation.
* Ensure assert is comptime only.
* Derive valid metadata characters from valid identifier characters.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
9a8e7ae186 core: add alias for Kitty desktop notification OSC struct 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
301b69df43 osc: save terminator from OSC 99 in case we need to send a response 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
202e639d97 osc: clean up comments in OSC 99 2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
93bf7d8104 osc: address review comments on OSC 99 (Kitty desktop notifications)
* Add comments to Option keys to clarify their usage without having
  to refer to the spec online.
* Use `indexOfNone` to simplify code.
2026-08-21 13:18:35 -07:00
Jeffrey C. Ollie
c67a1db991 osc: parse the Kitty desktop notification protocol (OSC 99)
This includes only parsing of the OSC. You cannot use OSC 99 to send
notifications. Uses lazy parsing of the metadata modelled on the new OSC
133 behavior.
2026-08-21 13:18:34 -07:00
Mitchell Hashimoto
819b241dec terminal: Kitty Clipboard core logic (no apprt hookups yet) (#13962)
This adds all the core logic and tests for the full Kitty Clipboard
protocol in the `src/terminal` package.

This is purposefully shaped similarly to the way we organize Kitty
graphics. There is an umbrella `clipboard.zig` and then a bunch of leaf
zig files that cover: request parsing, response encoding, state
management, etc. I think that worked really well for Kitty graphics so
we're doing it here too.

The core logic covers every part of the protocol: read and write.

The only thing hooked up to the end user is a DECRQM for mode 5522 will
return unset. And it can't be set currently (since it never works yet).
Outside of that, nothing in this diff is actually used in the real
binary.

**AI usage:** Validation against the spec and Kitty impl, test writing
and coverage validation, of course some code writing but within the
broad organizational shape I defined. I went through and either rewrote
or wrote all the comments myself plus this PR message.
2026-08-21 13:13:58 -07:00
Mitchell Hashimoto
c8634f3fce terminal: reload cell pointers when print grows a page (#13960)
Fixes #11261.

`Terminal.print`'s grapheme path caches a `*Cell` for the previous cell
and keeps using it after writing other cells. Writing the wide spacer
tail calls `printCell`, which can grow the page to make room for the
cursor hyperlink. Growing clones the page and frees the old one, so the
cached pointer dangles and the following `appendGrapheme` writes into
freed memory. The second test case in the issue reproduces it.

Rather than recomputing `prev` on every use, which is too expensive for
this path, the fix records the cursor page identity before the spacer
write and reloads the cell only if the page actually changed. Node
pointer plus serial is used because nodes are pooled and a replacement
can land on the same address. Nothing changes when the page does not
grow.

Three other pointers in the same function were held across an operation
that can replace a page, so they are now read through the cursor or a
freshly resolved pin: the grapheme move after a wrap, the grapheme
append loop, and `printCell`'s assert on a failed hyperlink write.

Tests:

- `Terminal: VS16 widening when the spacer tail grows the page` fills
the page hyperlink map so the spacer tail is what forces growth. It
crashes without the fix.
- `Terminal: grapheme transfer when widening wraps to the next line`
covers the wrap path where the previous cell already holds grapheme
data, which had no test before.

`zig build test` passes.
2026-08-21 12:51:35 -07:00
Mitchell Hashimoto
a8c3ab1915 simd: fix scalar base64 empty input handling causing a crash 2026-08-21 12:45:57 -07:00
Mitchell Hashimoto
128ec7cd04 terminal: rename paste_events mode to kitty_paste_events 2026-08-21 12:28:44 -07:00
ghostty-vouch[bot]
74a133ea17 Update VOUCHED list (#13961)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13960#issuecomment-5374295208)
from @jcollie.

Vouch: @ArneshBanerjee

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-21 19:25:42 +00:00
Mitchell Hashimoto
bcf44b40e6 terminal: dispatch OSC 5522 as a kitty_clipboard stream action, unhandled 2026-08-21 12:19:14 -07:00
Mitchell Hashimoto
07c6fc21ba terminal: add kitty clipboard paste events mode (5522), disabled for now 2026-08-21 12:16:38 -07:00
Mitchell Hashimoto
f2d4b32be3 terminal: expose kitty clipboard protocol (OSC 5522) for stream dispatch 2026-08-21 12:15:07 -07:00
Mitchell Hashimoto
6f007e7678 terminal: add kitty clipboard protocol (OSC 5522) session password grants 2026-08-21 12:13:56 -07:00
Mitchell Hashimoto
7a940ec028 terminal: add kitty clipboard protocol (OSC 5522) write transactions 2026-08-21 12:09:53 -07:00
Arnesh
33cda4dc5d terminal: reload cell pointers when print grows a page
Terminal.print's grapheme path holds a raw pointer to the previous cell
while it writes other cells. Writing the wide spacer tail can grow the
page to fit the cursor hyperlink, and growing replaces the page, so the
pointer is left dangling and the following appendGrapheme writes into
freed memory.

Record the cursor page identity (node pointer plus serial, since pooled
nodes can reuse an address) before the spacer write and reload the cell
only when the page actually changed, so the common path costs nothing.

The same function had three more pointers held across an operation that
can replace a page: the grapheme move after a wrap, the grapheme append
loop, and printCell's assert on a failed hyperlink write. Those now read
through the cursor or a freshly resolved pin.

Fixes #11261
2026-08-22 00:19:58 +05:30
Mitchell Hashimoto
e28acd928c terminal: add kitty clipboard protocol (OSC 5522) response encoding 2026-08-21 11:34:30 -07:00
Mitchell Hashimoto
25b1170d42 terminal: add kitty clipboard protocol (OSC 5522) command parsing 2026-08-21 10:45:20 -07:00
Mitchell Hashimoto
a88ad03e69 kitty graphics: animation support (#13943)
Fixes #5255

This adds support for the Kitty graphics animation frames
(https://sw.kovidgoyal.net/kitty/graphics-protocol/#animation),
completely (transmission, control, composition, rendering, etc.).

This does it in a somewhat naive way: we pre-compose all frames and
store the full RGBA in-memory. Animation is already rare enough, and I
wanted to focus on things working first, so I didn't optimize this very
well. I also wanted this PR to be relatively understandable up front. We
can add complexity later.

But, this adds very little overhead to a non-animation using Kitty
graphics user. The animation state is heap-allocated only when its
needed. So, it just costs a pointer sized field on every image. Plus a
little bit of overhead in the loading state (which itself is heap
allocated during image load only).

On the renderer side, this **unifies Kitty graphics animations and
custom shader animations into a single animation abstraction.** This
simplified our renderer thread and made the generic renderer more
complicated (slightly, its not much!).

**AI usage:** Test writing, validation against the spec/reference
implementation. I drove the main architecture and shaped out the
functions and params, animation storage, etc. I had AI fill in some of
the blanks that I spaced out. Commit messages, comments, and this PR
message are written by me.

## Demo



https://github.com/user-attachments/assets/91be3d66-a5ff-4cab-b3e9-e672f39861c9
2026-08-21 10:22:47 -07:00
Mitchell Hashimoto
5984d6f732 terminal: add isTextMime helper for plain text MIME type names 2026-08-21 10:16:25 -07:00
Mitchell Hashimoto
4be9d782e3 terminal: avoid Kitty image reset test if no kitty images 2026-08-21 10:00:06 -07:00
Mitchell Hashimoto
dff13b41c9 pkg/{afl++,wuffs}: fix builds for CI 2026-08-21 09:45:59 -07:00