Commit Graph

15724 Commits

Author SHA1 Message Date
Mitchell Hashimoto
6a99c248d0 terminal/kitty: add Limits to restrict capabilities of image transfer 2026-04-05 07:08:30 -07:00
Mitchell Hashimoto
29e3de737e terminal: make wuffs runtime-swappable, enable Kitty graphics for libvt
Introduce terminal/sys.zig which provides runtime-swappable function
pointers for operations that depend on external implementations. This
allows embedders of the terminal package to swap out implementations
at startup without hard dependencies on specific libraries.

The first function exposed is decode_png, which defaults to a wuffs
implementation. The kitty graphics image loader now calls through
sys.decode_png instead of importing wuffs directly.

This allows us to enable Kitty graphics support in libghostty-vt
for all targets except wasm32-freestanding.
2026-04-04 22:01:38 -07:00
Mitchell Hashimoto
c541ceb120 terminal: add APC handler to stream_terminal (#12116)
Wire up the APC handler to `terminal.TerminalStream` to process APC
sequences, enabling support for kitty graphics commands in libghostty,
in theory.

The "in theory" is because we still don't export a way to actually
enable Kitty graphics in libghostty because we have some other things in
the way: PNG decoding and OS filesystem access that need to be more
conditionally compiled before we can enable the feature. However, this
is a step in the right direction, and we can at least verify that the
APC handler works via a test in Ghostty GUI.
2026-04-04 21:21:10 -07:00
Mitchell Hashimoto
a8e92c9c53 terminal: add APC handler to stream_terminal
Wire up the APC handler to `terminal.TerminalStream` to process
APC sequences, enabling support for kitty graphics commands in 
libghostty, in theory.

The "in theory" is because we still don't export a way to actually
enable Kitty graphics in libghostty because we have some other things in
the way: PNG decoding and OS filesystem access that need to be more 
conditionally compiled before we can enable the feature. However, this
is a step in the right direction, and we can at least verify that the
APC handler works via a test in Ghostty GUI.
2026-04-04 21:11:31 -07:00
Mitchell Hashimoto
10696b5ed1 libghostty: add GhosttySelection type and selection support to formatter (#12115)
Add a new GhosttySelection C API type (selection.h / c/selection.zig)
that pairs two GhosttyGridRef endpoints with a rectangle flag. This maps
directly to the internal Selection type using untracked pins.

The formatter terminal options gain an optional selection pointer. When
non-null the formatter restricts output to the specified range instead
of emitting the entire screen. When null the existing behavior of
formatting the full screen is preserved.
2026-04-04 20:48:39 -07:00
Mitchell Hashimoto
86554de090 libghostty: add hyperlink URI accessor to grid_ref API (#12114)
Add ghostty_grid_ref_hyperlink_uri to extract the OSC 8 hyperlink URI
from a cell at a grid reference position. Follows the same buffer
pattern as ghostty_grid_ref_graphemes: callers pass a buffer and get
back the byte length, or GHOSTTY_OUT_OF_SPACE with the required size if
the buffer is too small. Cells without a hyperlink return success with
length 0.
2026-04-04 20:39:07 -07:00
Mitchell Hashimoto
757eff5881 libghostty: add GhosttySelection type and selection support to formatter
Add a new GhosttySelection C API type (selection.h / c/selection.zig)
that pairs two GhosttyGridRef endpoints with a rectangle flag. This
maps directly to the internal Selection type using untracked pins.

The formatter terminal options gain an optional selection pointer.
When non-null the formatter restricts output to the specified range
instead of emitting the entire screen. When null the existing
behavior of formatting the full screen is preserved.
2026-04-04 20:38:05 -07:00
Mitchell Hashimoto
b9a241d1e2 libghostty: add hyperlink URI accessor to grid_ref API
Add ghostty_grid_ref_hyperlink_uri to extract the OSC 8 hyperlink
URI from a cell at a grid reference position. Follows the same
buffer pattern as ghostty_grid_ref_graphemes: callers pass a buffer
and get back the byte length, or GHOSTTY_OUT_OF_SPACE with the
required size if the buffer is too small. Cells without a hyperlink
return success with length 0.
2026-04-04 20:28:13 -07:00
ghostty-vouch[bot]
cf8a2407a0 Update VOUCHED list (#12113)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12098#discussioncomment-16452103)
from @mitchellh.

Vouch: @fru1tworld

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-05 03:17:59 +00:00
Jeffrey C. Ollie
0a4cf5877e nix: add option to disable simd in libghostty-vt package (#12103) 2026-04-04 16:06:26 -05:00
Jeffrey C. Ollie
1bd7c19dac nix: add option to disable simd in libghostty-vt package 2026-04-04 15:06:19 -05:00
Mitchell Hashimoto
0a492fdb33 build: add pkg-config static linking support and fat archives to libghostty (#12096)
The libghostty-vt pkg-config file was missing Libs.private, so
pkg-config --libs --static returned the same flags as the shared case,
omitting the C++ standard library needed by the SIMD code.

Additionally, the static archive did not bundle the vendored SIMD
dependencies (simdutf, highway, utfcpp), leaving consumers with
unresolved symbols when linking. If we're choosing to vendor (no -fsys)
then we should produce a fat static archive that includes them. If
`-fsys` is used, then we should not bundle them and instead reference
them via Requires.private, letting pkg-config chain to their own .pc
files.

Add Libs.private with the C++ runtime (-lc++ on Darwin, -lstdc++ on
Linux) and Requires.private for any SIMD deps provided via system
integration. When SIMD deps are vendored (the default), produce a fat
static archive that bundles them using libtool on Darwin and ar on
Linux. When they come from the system (-fsys=), reference them via
Requires.private instead, letting pkg-config chain to their own .pc
files.
2026-04-04 06:56:19 -07:00
Mitchell Hashimoto
e157dd69c5 build: add pkg-config static linking support and fat archives to libghostty
The libghostty-vt pkg-config file was missing Libs.private, so
pkg-config --libs --static returned the same flags as the shared
case, omitting the C++ standard library needed by the SIMD code.

Additionally, the static archive did not bundle the vendored SIMD
dependencies (simdutf, highway, utfcpp), leaving consumers with
unresolved symbols when linking. If we're choosing to vendor (no -fsys)
then we should produce a fat static archive that includes them. If `-fsys`
is used, then we should not bundle them and instead reference them via
Requires.private, letting pkg-config chain to their own .pc files.

Add Libs.private with the C++ runtime (-lc++ on Darwin, -lstdc++
on Linux) and Requires.private for any SIMD deps provided via
system integration. When SIMD deps are vendored (the default),
produce a fat static archive that bundles them using libtool on
Darwin and ar on Linux. When they come from the system (-fsys=),
reference them via Requires.private instead, letting pkg-config
chain to their own .pc files.
2026-04-04 06:54:42 -07:00
Mitchell Hashimoto
707cd57acb add a nix package (with CI tests) for libghostty-vt (#12090) 2026-04-03 20:12:52 -07:00
ghostty-vouch[bot]
e3bbd54dd3 Update VOUCHED list (#12094)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12093#discussioncomment-16444399)
from @jcollie.

Vouch: @jordandm

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-04 01:46:07 +00:00
Jeffrey C. Ollie
326178adb8 nix: address review comments
* split out dev subpackage
* change version number to 0.1.0
* supported on same platforms as Zig
2026-04-03 20:19:50 -05:00
Jeffrey C. Ollie
4f825e87f5 add a nix package (with CI tests) for libghostty-vt 2026-04-03 16:28:21 -05:00
Mitchell Hashimoto
0790937d03 macOS: fix Find Next/Previous button in the menu bar is not working as expected (#12070)
I don’t know why the search-related commands were added as performable
keybinds in 240d5e0fc5, but **I asked
Claude to add some tests for that**

> This won't fix cmd+g/G not working when the search bar is focused.
2026-04-02 12:56:39 -07:00
Lukas
18f2702225 macOS: fix Find Next/Previous button in the menu bar is not working as expected 2026-04-02 20:31:31 +02:00
ghostty-vouch[bot]
7747c96033 Update VOUCHED list (#12069)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/12068#issuecomment-4179350272)
from @jcollie.

Vouch: @Douglas-MacGregor

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-02 17:28:57 +00:00
ghostty-vouch[bot]
63372f8ddb Update VOUCHED list (#12066)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12038#discussioncomment-16423690)
from @mitchellh.

Vouch: @h3nock

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-02 13:53:39 +00:00
ghostty-vouch[bot]
48d3e972d8 Update VOUCHED list (#12052)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/12050#issuecomment-4173393542)
from @mitchellh.

Vouch: @justonia

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-01 22:42:46 +00:00
Mitchell Hashimoto
b8251de7e8 fix: Ensure snap paths come first in gio module loading (#12045)
This fixes the issue reported in
https://github.com/ghostty-org/ghostty/discussions/11311
2026-04-01 14:32:27 -07:00
Mitchell Hashimoto
92a4601f39 Revert "macOS: close search bar if needed when it loses focus (#11980)" (#12046)
This reverts commit 20cfaae2e5, reversing
changes made to 3509ccf78e.

This breaks some behaviours when there are multiple splits, which
requires another click to focus to another split in the same window🫪
2026-04-01 14:32:09 -07:00
Ken VanDine
c16cf0ef07 fix: Ensure snap paths come first in gio module loading 2026-04-01 13:30:40 -04:00
Lukas
9ec5672505 Revert "macOS: close search bar if needed when it loses focus (#11980)"
This reverts commit 20cfaae2e5, reversing
changes made to 3509ccf78e.
2026-04-01 19:21:42 +02:00
Mitchell Hashimoto
f6e6bb0238 macOS: fix upper cased letter is not correctly mapped to menu shortcut (#12039)
This is known issues before key-related PRs, tested on
fa9265636b.

The following config is mapped incorrectly to the menu shortcut:
```
keybind=A=goto_split:left
```
<img width="223" height="106" alt="image"
src="https://github.com/user-attachments/assets/b80da251-9cff-4b29-b143-64854a5c4271"
/>

Surfaces only accept `a` as a trigger to select left split, not
`shift+a`
2026-04-01 08:10:47 -07:00
Leah Amelia Chen
6d15b53fc7 gtk(chore): fix typos (#12036) 2026-04-01 22:12:23 +08:00
Lukas
702a2b43c3 macOS: fix upper cased letter is not correctly mapped to menu shortcut 2026-04-01 14:50:53 +02:00
Lukas
c8702ece8f gtk(chore): fix typos
### AI Disclosure

Claude wrote the regex to ignore base64-encoded sequences
2026-04-01 13:08:55 +02:00
ghostty-vouch[bot]
b7e56044db Update VOUCHED list (#12031)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/12030#issuecomment-4167464133)
from @mitchellh.

Vouch: @Jarred-Sumner

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-01 04:59:00 +00:00
Jeffrey C. Ollie
c2dd7579e2 core/gtk: ensure that first surface gets marked as focused surface by app (#12029) 2026-03-31 15:29:18 -05:00
Jeffrey C. Ollie
0f6836c69f gtk: use surface id for notifications instead of pointer (#12028) 2026-03-31 15:07:47 -05:00
Jeffrey C. Ollie
4b5f2d60e7 core/gtk: ensure that first surface gets marked as focused surface by app 2026-03-31 14:57:41 -05:00
Jeffrey C. Ollie
dee8598dc0 gtk: use surface id for notifications instead of pointer 2026-03-31 14:53:19 -05:00
Jeffrey C. Ollie
f90180f91f core: add 64 bit unique ID to every core surface (#12027)
- Expose that ID as the environment variable GHOSTTY_SURFACE_ID to
processes running in Ghostty surfaces.
- Add a function to the core app to search for surfaces by ID.
- ID is randomly generated, it has no other meaning other than as a
unique identifier for the surface. The ID also cannot be zero as that is
used to indicate a null ID in some situations.
2026-03-31 14:50:00 -05:00
Jeffrey C. Ollie
ff02ed1b34 core: add 64 bit unique ID to every core surface
- Expose that ID as the environment variable GHOSTTY_SURFACE_ID to
  processes running in Ghostty surfaces.
- Add a function to the core app to search for surfaces by ID.
- ID is randomly generated, it has no other meaning other than as a
  unique identifier for the surface. The ID also cannot be zero as that
  is used to indicate a null ID in some situations.
2026-03-31 13:13:05 -05:00
Mitchell Hashimoto
f16d35489b apprt/embedded: fix ghostty_surface_free_text parameter mismatch (#12025)
Fixes #12020

The C header declared ghostty_surface_free_text with both a
ghostty_surface_t and ghostty_text_s* parameter, but the Zig
implementation only accepted a *Text parameter. This caused the surface
pointer to be interpreted as the text pointer, so the actual text
allocation was never freed.

I opted to keep the surface parameter to minimize the diff here. I'm not
sure why I thought I would need access to that surface pointer but just
want to fix the leak first.
2026-03-31 09:52:25 -07:00
Mitchell Hashimoto
4803d58bb4 apprt/embedded: fix ghostty_surface_free_text parameter mismatch
Fixes #12020

The C header declared ghostty_surface_free_text with both a
ghostty_surface_t and ghostty_text_s* parameter, but the Zig
implementation only accepted a *Text parameter. This caused the
surface pointer to be interpreted as the text pointer, so the
actual text allocation was never freed.
2026-03-31 09:46:35 -07:00
ghostty-vouch[bot]
b2880636af Update VOUCHED list (#12022)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12019#discussioncomment-16396278)
from @jcollie.

Vouch: @danneu

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-31 14:56:43 +00:00
Mitchell Hashimoto
292bf13d06 macOS: Make version in about dialog clickable (#12007)
- Fixes: https://github.com/ghostty-org/ghostty/issues/11964

Made a private enum type `VersionConfig` to reference whether the
release is a semver or tip, makes it easier for later in the view to
`switch` between cases.

I do think there could be a better place for this enum or we can get rid
of it, open to opinions. Right now version parsing is kind of duplicated
between `AboutView` and `UpdateModalView` so we can also extract to a
common helper if wanted.

Tested by manually setting `Marketing Version` in build settings to 

`1.3.1`
<img width="412" height="532" alt="Screenshot 2026-03-30 at 18 31 15"
src="https://github.com/user-attachments/assets/285bb94d-138b-4169-bb66-684eb04b6ca3"
/>

`332b2aefc`
<img width="412" height="532" alt="Screenshot 2026-03-30 at 18 32 48"
src="https://github.com/user-attachments/assets/fea30d39-bea7-4885-8221-1696e148f45e"
/>

### AI Disclosure
I used Sonnet 4.6 to understand where the version strings came from and
in what format, it read release yml files to see what's going on. Then
it proposed really bad code so I manually went in and cleaned up the
view.
2026-03-31 06:38:59 -07:00
Mitchell Hashimoto
5fe876cfa0 ghostty.h: guard sys/types.h include for MSVC (#12010)
## Summary

- Move `sys/types.h` include into the `#else` branch of the existing
`_MSC_VER` guard
- MSVC does not ship `sys/types.h` (POSIX header), and already gets
`ssize_t` from `BaseTsd.h`

## Test plan

- [x] `zig build -Dapp-runtime=none` -- clean build
- [x] `zig build test -Dapp-runtime=none` on Windows (2606/2660 passed,
54 skipped)
- [x] `zig build test` on Linux (2658/2684 passed, 26 skipped)
- [x] `zig build test` on macOS (2658/2668 passed, 10 skipped)
- [x] `zig build test-lib-vt` on all 3 platforms
- [x] Zig examples build on all 3 platforms
- [x] CMake examples build on Windows (c-vt-cmake pass,
c-vt-cmake-static pass)
2026-03-31 06:38:36 -07:00
Mitchell Hashimoto
f140b1463f macOS: fix incorrect delete symbol mapping (#12011)
`GHOSTTY_KEY_DELETE` should be mapped to `KeyEquivalent.deleteForward`.
This fixes the correct symbol showing in the menu. Previously, both
`GHOSTTY_KEY_DELETE` and `GHOSTTY_KEY_BACKSPACE` were showing `⌫`, but
`GHOSTTY_KEY_DELETE` only worked for `fn+delete`.

Add the following keybind and observe the symbol in the menu:
```
keybind=delete=new_tab
```

<img width="535" height="318" alt="image"
src="https://github.com/user-attachments/assets/67ed7b5d-f848-42ee-a382-fe364d86cb2c"
/>
2026-03-31 06:38:25 -07:00
Mitchell Hashimoto
f827530103 libghostty: add all C struct layout metadata for WASM (#12017)
Added all C structs and sorted the entries for readability.
2026-03-31 06:01:49 -07:00
Elias Andualem
1d0a247c20 sort map alphabetically 2026-03-31 19:34:52 +08:00
Elias Andualem
30c9dec76b add all C struct layout metadata for WASM 2026-03-31 19:28:46 +08:00
Lukas
591dbd5112 macOS: fix incorrect delete symbol mapping 2026-03-31 10:27:12 +02:00
Louis Qian
010880a90a chore: make url computed property & rework enum signature 2026-03-30 20:15:01 -07:00
Mitchell Hashimoto
20cfaae2e5 macOS: close search bar if needed when it loses focus (#11980)
This adds features like:

1. Clicking outside of search bar works like typing `escape`
2. Typing `tab` while search bar is focused also works like typing
`escape`


https://github.com/user-attachments/assets/a51f1560-ed14-4002-81b4-96eb927b17ca
2026-03-30 19:39:26 -07:00
Louis Qian
183e2cef2f chore: clean up switch statement 2026-03-30 18:51:45 -07:00