Commit Graph

15840 Commits

Author SHA1 Message Date
Mitchell Hashimoto
7f6d2a44b8 macOS: fix cannot rebind super+up and super+down (#12245)
Fix: #11989
Cause identified to: ab352b5af9
Original PR: #10003
Problem: I don't think it is OK to hard code the keybind like this at
all. Ghostty's config is flexible enough to achieve this.
Proposal: Revert the above commit via this PR.

@yasuf @bo2themax
2026-04-12 13:16:06 -07:00
Mitchell Hashimoto
032596442f macOS: clean up duplicated declarations in SurfaceView_AppKit/UIKit (#12250)
Added a shared `OSSurfaceView` as the base class to share common
variables and functions across platforms.

Each commit contains a small change to move one or two variables or
functions to `OSSurfaceView`.
2026-04-12 13:15:52 -07:00
Lukas
bf6fd4abe5 macOS: add focusDidChange & sizeDidChange placeholders to OSSurfaceView 2026-04-12 14:23:46 +02:00
Lukas
90ea604a7c macOS: move searchState to OSSurfaceView 2026-04-12 14:23:46 +02:00
Lukas
a541e23120 macOS: move surface to OSSurfaceView 2026-04-12 14:23:46 +02:00
Lukas
1665755a93 macOS: move highlighted to OSSurfaceView 2026-04-12 14:23:46 +02:00
Lukas
2efe851cda macOS: move readonly to OSSurfaceView 2026-04-12 14:23:45 +02:00
Lukas
3834751aef macOS: move surfaceSize to OSSurfaceView 2026-04-12 12:08:56 +02:00
Lukas
7c83561f9e macOS: move focusInstant to OSSurfaceView 2026-04-12 12:07:22 +02:00
Lukas
56b505cbb0 macOS: move keyTables to OSSurfaceView 2026-04-12 12:06:28 +02:00
Lukas
19af8e9ce2 macOS: move progressReport to OSSurfaceView 2026-04-12 12:04:09 +02:00
Lukas
8b99c77bf7 macOS: update title comments 2026-04-12 12:02:59 +02:00
Lukas
619e12dc75 macOS: move hoverUrl to OSSurfaceView 2026-04-12 11:59:51 +02:00
Lukas
3936069297 macOS: move healthy and error to OSSurfaceView 2026-04-12 11:59:04 +02:00
Lukas
d38301bb9f macOS: move cellSize to OSSurfaceView 2026-04-12 11:58:04 +02:00
Lukas
46fef7718c macOS: move pwd to OSSurfaceView 2026-04-12 11:57:15 +02:00
Lukas
8bd1aba40a macOS: add shared OSSurfaceView 2026-04-12 11:54:16 +02:00
Mitchell Hashimoto
557de7c925 build: stop linking libc++ for utfcpp (#12239)
utfcpp is a header-only dependency, so its package wrapper does not need
to link the C++ standard library. Keep the empty static archive for
build integration, but stop adding an unnecessary libc++ dependency.
2026-04-11 14:55:11 -07:00
Mitchell Hashimoto
5e102c9dc7 build: stop linking libc++ for utfcpp
utfcpp is a header-only dependency, so its package wrapper does not
need to link the C++ standard library. Keep the empty static archive
for build integration, but stop adding an unnecessary libc++
dependency.
2026-04-11 14:44:05 -07:00
Mitchell Hashimoto
fa2c3a1e60 pkg/highway: drop libc++ dependency from vendored hwy (#12238)
The vendored Highway package was being built with libc++ even though
Ghostty only uses its runtime target selection and dispatch support.
That pulled in extra C++ runtime baggage from upstream support files
such as abort, timer, print, and benchmark helpers.

Build Highway in HWY_NO_LIBCXX mode, only compile the target dispatch
sources we actually need, and compile Ghostty's SIMD translation units
with the same define so the header ABI stays consistent. Replace the
upstream abort implementation with a small local bridge that provides
Highway's Warn/Abort hooks and the target-query shim without depending
on libc++.

This keeps the Highway archive down to the dispatch pieces Ghostty uses
while preserving the existing dynamic dispatch behavior. The bridge is
documented so it is clear why Ghostty carries this small local
replacement.

We still depend on libc++ for other reasons, but I figure we should just
trim it down as needed. 😄
2026-04-11 14:41:55 -07:00
Mitchell Hashimoto
3e6a65f73f pkg/highway: drop libc++ from vendored hwy
The vendored Highway package was being built with libc++ even though
Ghostty only uses its runtime target selection and dispatch support.
That pulled in extra C++ runtime baggage from upstream support files
such as abort, timer, print, and benchmark helpers.

Build Highway in HWY_NO_LIBCXX mode, only compile the target dispatch
sources we actually need, and compile Ghostty's SIMD translation units
with the same define so the header ABI stays consistent. Replace the
upstream abort implementation with a small local bridge that provides
Highway's Warn/Abort hooks and the target-query shim without depending
on libc++.

This keeps the Highway archive down to the dispatch pieces Ghostty
uses while preserving the existing dynamic dispatch behavior. The
bridge is documented so it is clear why Ghostty carries this small
local replacement.
2026-04-11 14:28:56 -07:00
Mitchell Hashimoto
c36b458ad5 libghostty: add _get_multi to all _get APIs (#12236)
Replace the ImageInfo and PlacementInfo sized structs and their
associated .info enum variants with a new _get_multi pattern that
batches multiple enum+pointer pairs into a single call. This avoids
struct ABI concerns (field order, padding, alignment,
GHOSTTY_INIT_SIZED) while preserving the single-call-crossing
performance benefit for FFI and Cgo callers.

Each _get_multi function takes an array of enum keys, an array of output
pointers, and an optional out_written parameter that reports how many
values were successfully written before any error. This applies
uniformly to all _get APIs: terminal_get, cell_get, row_get,
render_state_get, render_state_row_get, render_state_row_cells_get,
kitty_graphics_image_get, and kitty_graphics_placement_get.

The C example is updated to use compound-literal _get_multi calls, and
tests cover both success and error paths for every new function.
2026-04-11 12:56:49 -07:00
Mitchell Hashimoto
abf1332737 macOS: fix memory leak of TerminalController (#12237)
Regression of #12119, this memory leak affects new tabs, since the
terminal controller is not deallocated correctly, hitting `cmd+t` will
create a new window with two tabs, but only one actually contains usable
surface.

You can reproduce by:
1. Quit and Reopen Ghostty
2. Open a new window if no window is created (initial-window = false)
3. Close the window
4. Hit `cmd+t`
2026-04-11 12:51:53 -07:00
Mitchell Hashimoto
2c1dad790b libghostty: add _get_multi to all _get APIs
Replace the ImageInfo and PlacementInfo sized structs and their
associated .info enum variants with a new _get_multi pattern that
batches multiple enum+pointer pairs into a single call. This avoids
struct ABI concerns (field order, padding, alignment, GHOSTTY_INIT_SIZED)
while preserving the single-call-crossing performance benefit for FFI
and Cgo callers.

Each _get_multi function takes an array of enum keys, an array of
output pointers, and an optional out_written parameter that reports
how many values were successfully written before any error. This
applies uniformly to all _get APIs: terminal_get, cell_get, row_get,
render_state_get, render_state_row_get, render_state_row_cells_get,
kitty_graphics_image_get, and kitty_graphics_placement_get.

The C example is updated to use compound-literal _get_multi calls,
and tests cover both success and error paths for every new function.
2026-04-11 12:51:36 -07:00
Lukas
650cd96646 macOS: fix memory leak of TerminalController
Regression of #12119, this memory leak affects new tabs, since the terminal controller is not deallocated correctly. Hitting `cmd+t` will create a new window with two tabs, but only one actually contains usable surface.

You can reproduce by:
1. Quit and Reopen Ghostty
2. Open a new window if no window is created (initial-window = false)
3. Close the window
4. Hit `cmd+t`
2026-04-11 21:20:16 +02:00
Mitchell Hashimoto
7421b4b13f libghostty: add convenience accessors for kitty graphics (#12229)
Add three sized structs that let callers fetch all image, placement, or
rendering metadata in a single call instead of many individual queries.
This is an optimization for environments with high per-call overhead
such as FFI or Cgo.

GhosttyKittyGraphicsImageInfo is returned via image_get() with the new
GHOSTTY_KITTY_IMAGE_DATA_INFO data kind. It bundles id, number, width,
height, format, compression, data pointer, and data length.

GhosttyKittyGraphicsPlacementInfo is returned via placement_get() with
the new GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_INFO data kind. It bundles
image id, placement id, virtual flag, offsets, source rect, columns,
rows, and z-index.

GhosttyKittyGraphicsPlacementRenderInfo is returned by the new
ghostty_kitty_graphics_placement_render_info() function, which combines
pixel size, grid size, viewport position, and resolved source rectangle.
This one requires image and terminal handles so it does not fit the
existing _get() pattern and is a dedicated function.

All three use the sized-struct ABI pattern with GHOSTTY_INIT_SIZED for
forward compatibility.
2026-04-10 14:26:28 -07:00
Mitchell Hashimoto
3295bf40a7 libghostty: add convenience accessors for kitty graphics
Add three sized structs that let callers fetch all image, placement,
or rendering metadata in a single call instead of many individual
queries. This is an optimization for environments with high per-call
overhead such as FFI or Cgo.

GhosttyKittyGraphicsImageInfo is returned via image_get() with the
new GHOSTTY_KITTY_IMAGE_DATA_INFO data kind. It bundles id, number,
width, height, format, compression, data pointer, and data length.

GhosttyKittyGraphicsPlacementInfo is returned via placement_get()
with the new GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_INFO data kind.
It bundles image id, placement id, virtual flag, offsets, source
rect, columns, rows, and z-index.

GhosttyKittyGraphicsPlacementRenderInfo is returned by the new
ghostty_kitty_graphics_placement_render_info() function, which
combines pixel size, grid size, viewport position, and resolved
source rectangle. This one requires image and terminal handles so
it does not fit the existing _get() pattern and is a dedicated
function.

All three use the sized-struct ABI pattern with GHOSTTY_INIT_SIZED
for forward compatibility.
2026-04-10 14:16:24 -07:00
Jeffrey C. Ollie
d3ce8926b9 build: skip ghostty-test graph when building libghostty-vt (#12224)
Fixes #12151

When `emit_lib_vt` is true, the `// Tests` block was still
evaluated, pulling in the full ghostty-test dependency graph
(freetype, zlib, dcimgui, etc.). This causes the Nix
`libghostty-vt` package to fail when `doCheck` is enabled,
since those system libraries aren't available in the sandbox.

Guard the block with `if (!config.emit_lib_vt)`, following
the existing pattern at line 179.
2026-04-10 13:41:11 -05:00
Mitchell Hashimoto
c34901dddb libghostty: add log callback configuration (#12227)
In C ABI builds, the Zig std.log default writes to stderr which is not
appropriate for a library. Override std_options.logFn with a custom sink
that dispatches to an embedder-provided callback, or silently discards
when none is registered.

Add GHOSTTY_SYS_OPT_LOG to ghostty_sys_set() following the existing
decode_png pattern. The callback receives the log level as a
GhosttySysLogLevel enum, scope and message as separate byte slices,
giving embedders full control over formatting and routing.

Export ghostty_sys_log_stderr as a built-in convenience callback that
writes to stderr using std.debug.lockStderrWriter for thread-safe
output. Embedders who want the old behavior can install it at startup
with a single ghostty_sys_set call.
2026-04-10 11:03:18 -07:00
Mitchell Hashimoto
aa6943da37 libghostty: add log callback configuration
In C ABI builds, the Zig std.log default writes to stderr which is
not appropriate for a library. Override std_options.logFn with a
custom sink that dispatches to an embedder-provided callback, or
silently discards when none is registered.

Add GHOSTTY_SYS_OPT_LOG to ghostty_sys_set() following the existing
decode_png pattern. The callback receives the log level as a
GhosttySysLogLevel enum, scope and message as separate byte slices,
giving embedders full control over formatting and routing.

Export ghostty_sys_log_stderr as a built-in convenience callback that
writes to stderr using std.debug.lockStderrWriter for thread-safe
output. Embedders who want the old behavior can install it at startup
with a single ghostty_sys_set call.
2026-04-10 10:52:45 -07:00
Mitchell Hashimoto
7127abfe28 cmake: add ghostty_vt_add_target() for cross-compilation (#12212)
Add a ghostty_vt_add_target() CMake function that lets downstream
projects build libghostty-vt for a specific Zig target triple. The
function encapsulates zig discovery, build-type-to-optimize mapping, the
zig build invocation, and output path conventions so consumers do not
need to duplicate any of that logic. It creates named IMPORTED targets
(e.g. ghostty-vt-static-linux-amd64) that work alongside the existing
native ghostty-vt and ghostty-vt-static targets.

The build-type mapping is factored into a shared _GHOSTTY_ZIG_OPT_FLAG
variable used by both the native build and the new function.

A new example/c-vt-cmake-cross/ demonstrates end-to-end cross-
compilation using zig cc as the C compiler, auto-detecting a cross
target based on the host OS.
2026-04-10 08:00:03 -07:00
ghostty-vouch[bot]
b5d54d8f51 Update VOUCHED list (#12225)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12223#discussioncomment-16518906)
from @jcollie.

Vouch: @kataokatsuki

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-10 14:31:37 +00:00
Mitchell Hashimoto
f2e299fb46 cmake: add ghostty_vt_add_target() for cross-compilation
Add a ghostty_vt_add_target() CMake function that lets downstream
projects build libghostty-vt for a specific Zig target triple. The
function encapsulates zig discovery, build-type-to-optimize mapping,
the zig build invocation, and output path conventions so consumers
do not need to duplicate any of that logic. It creates named IMPORTED
targets (e.g. ghostty-vt-static-linux-amd64) that work alongside the
existing native ghostty-vt and ghostty-vt-static targets.

The build-type mapping is factored into a shared _GHOSTTY_ZIG_OPT_FLAG
variable used by both the native build and the new function.

The static library targets now propagate c++ as a link dependency on
non-Windows platforms, fixing link failures when consumers use static
linking with the default SIMD-enabled build.

A new example/c-vt-cmake-cross/ demonstrates end-to-end cross-
compilation using zig cc as the C compiler, auto-detecting a cross
target based on the host OS.
2026-04-10 06:52:09 -07:00
kataokatsuki
85be3ca2c1 build: skip ghostty-test graph when building libghostty-vt
Fixes #12151
2026-04-10 22:41:16 +09:00
Mitchell Hashimoto
19b0ed2bdf macOS: double click title to enlarge window (#12219)
Previously with `macos-titlebar-style = tabs`, double clicking title
would do nothing
2026-04-10 06:18:11 -07:00
Mitchell Hashimoto
d51e94f7eb macOS: fix tab title editor frame update during winding resizing (#12220)
https://github.com/user-attachments/assets/69bee4f9-e3e1-4dc7-8e9c-c395572d2dbf
2026-04-10 06:17:35 -07:00
Lukas
41c872c1f4 macOS: fix tab title editor frame update during winding resizing 2026-04-10 13:57:09 +02:00
Lukas
e7f58ad72e macOS: double click title to enlarge window
Previously with `macos-titlebar-style	= tabs`, double clicking title will do nothing
2026-04-10 13:41:53 +02:00
ghostty-vouch[bot]
1348e04626 Update VOUCHED list (#12216)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12213#discussioncomment-16512677)
from @pluiedev.

Vouch: @otomn

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-10 06:52:01 +00:00
Mitchell Hashimoto
48a01b8bd5 build: add libghostty-vt-static pkg-config module (#12210)
Keep libghostty-vt.pc as the shared/default pkg-config module so
`pkg-config --static libghostty-vt` continues to emit the historical
`-lghostty-vt` flags. This preserves the old behavior for consumers that
still want it, even though that form remains ambiguous on macOS when
both the dylib and archive are installed in the same directory.

Add a separate libghostty-vt-static.pc module for consumers that need an
unambiguous static link. Its `Libs:` entry points directly at the
installed archive so macOS does not resolve the request to the dylib.

Update the Nix packaging to rewrite the new static module into the `dev`
output, use it in the static-link smoke test, and add a compatibility
check that covers both pkg-config entry points.
2026-04-09 20:38:03 -07:00
Mitchell Hashimoto
a82e156925 build: add libghostty-vt-static pkg-config module
Keep libghostty-vt.pc as the shared/default pkg-config module so
`pkg-config --static libghostty-vt` continues to emit the historical
`-lghostty-vt` flags. This preserves the old behavior for consumers
that still want it, even though that form remains ambiguous on macOS
when both the dylib and archive are installed in the same directory.

Add a separate libghostty-vt-static.pc module for consumers that need
an unambiguous static link. Its `Libs:` entry points directly at the
installed archive so macOS does not resolve the request to the dylib.

Update the Nix packaging to rewrite the new static module into the `dev`
output, use it in the static-link smoke test, and add a compatibility
check that covers both pkg-config entry points.
2026-04-09 20:27:30 -07:00
Mitchell Hashimoto
1a5bfbd87c build: sanitize all invalid chars in branch name for version (#12206)
Fixes #11990

Previously only slashes were replaced with hyphens in the branch name
used as the semver pre-release identifier. Branch names containing dots
(e.g. dependabot branches like
"cachix/install-nix-action-31.10.4") would cause an InvalidVersion error
because std.SemanticVersion only allows alphanumeric characters and
hyphens in pre-release identifiers.

Replace all non-alphanumeric, non-hyphen characters instead of only
slashes.
2026-04-09 13:15:14 -07:00
Mitchell Hashimoto
ad9225a4ca build: sanitize all invalid chars in branch name for version
Fixes #11990

Previously only slashes were replaced with hyphens in the branch
name used as the semver pre-release identifier. Branch names
containing dots (e.g. dependabot branches like
"cachix/install-nix-action-31.10.4") would cause an InvalidVersion
error because std.SemanticVersion only allows alphanumeric
characters and hyphens in pre-release identifiers.

Replace all non-alphanumeric, non-hyphen characters instead of
only slashes.
2026-04-09 13:09:01 -07:00
Mitchell Hashimoto
4cfbdaf8aa build(deps): bump cachix/install-nix-action from 31.10.3 to 31.10.4 (#12196)
Bumps
[cachix/install-nix-action](https://github.com/cachix/install-nix-action)
from 31.10.3 to 31.10.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cachix/install-nix-action/releases">cachix/install-nix-action's
releases</a>.</em></p>
<blockquote>
<h2>v31.10.4</h2>
<h2>What's Changed</h2>
<ul>
<li>nix: 2.34.4 -&gt; 2.34.5 by <a
href="https://github.com/github-actions"><code>@​github-actions</code></a>[bot]
in <a
href="https://redirect.github.com/cachix/install-nix-action/pull/273">cachix/install-nix-action#273</a>
<strong>[SECURITY]</strong> Fixes a root privilege escalation
vulnerability via sandbox escape <a
href="https://github.com/NixOS/nix/security/advisories/GHSA-g3g9-5vj6-r3gj">https://github.com/NixOS/nix/security/advisories/GHSA-g3g9-5vj6-r3gj</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/cachix/install-nix-action/compare/v31.10.3...v31.10.4">https://github.com/cachix/install-nix-action/compare/v31.10.3...v31.10.4</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="616559265b"><code>6165592</code></a>
Merge pull request <a
href="https://redirect.github.com/cachix/install-nix-action/issues/273">#273</a>
from cachix/create-pull-request/patch</li>
<li><a
href="b9f700df68"><code>b9f700d</code></a>
nix: 2.34.4 -&gt; 2.34.5</li>
<li>See full diff in <a
href="96951a368b...616559265b">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cachix/install-nix-action&package-manager=github_actions&previous-version=31.10.3&new-version=31.10.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
2026-04-09 13:01:53 -07:00
dependabot[bot]
1855b3efcc build(deps): bump cachix/install-nix-action from 31.10.3 to 31.10.4
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 31.10.3 to 31.10.4.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Changelog](https://github.com/cachix/install-nix-action/blob/master/RELEASE.md)
- [Commits](96951a368b...616559265b)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-version: 31.10.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 00:15:52 +00:00
Mitchell Hashimoto
28972454c0 libghostty-vt: nix package updates and more nix tests (#12152) 2026-04-08 11:00:49 -07:00
Mitchell Hashimoto
e740f6fc11 macOS: fix icon style not updating properly on Tahoe (#12180)
This is a regression from #9983. When resetting to default, we shouldn't
use the representation of the icon, which will prevent the icon from
updating after system settings change.

1. Delete `macos-icon` config if it exists and reload.
2. Go to **System Settings -> Appearance** and change **Icon & widget
style** to any one other than Default, and observe the app icon.


<img width="228" height="179" alt="image"
src="https://github.com/user-attachments/assets/e53274f8-b679-4d6f-8e0b-edfd7d17811d"
/>

> A temporary workaround to this issue is to reload the config.

This pr resets the `NSDockTile.contentView`, which will let AppKit
revert back to `Ghostty.icon`.



https://github.com/user-attachments/assets/06ab0519-225b-45e1-85a5-a22832a36177
2026-04-08 10:59:57 -07:00
Mitchell Hashimoto
a1c6f800c5 libghostty: add MAX_VALUE sentinels to all C enums for 32-bit sizing (#12189)
Pre-C23, the C standard allows compilers to choose any integer type
that can represent all enum values, so small enums could be backed
by char or short. This breaks ABI compatibility with the Zig side,
which backs these enums with c_int.

Define GHOSTTY_ENUM_MAX_VALUE as INT_MAX in types.h and add it as
the last entry in every enum in include/ghostty/vt/. This forces
the compiler to use int as the backing type, matching c_int on all
targets. INT_MAX is used rather than a fixed constant because enum
constants must be representable as int; values above INT_MAX are a
constraint violation in standard C.

Document this convention in AGENTS.md.
2026-04-08 10:56:52 -07:00
Mitchell Hashimoto
f282f13a21 libghostty: add GHOSTTY_ENUM_TYPED and GHOSTTY_ENUM_MAX_VALUE to all C enums
GHOSTTY_ENUM_TYPED: expands to `: int` on C23 (where explicit enum
underlying types are supported), empty on older standards.
2026-04-08 10:43:15 -07:00
Mitchell Hashimoto
9897d6caba libghostty: add GHOSTTY_ENUM_MAX_VALUE sentinel to all C enums
Pre-C23, the C standard allows compilers to choose any integer type
that can represent all enum values, so small enums could be backed
by char or short. This breaks ABI compatibility with the Zig side,
which backs these enums with c_int.

Define GHOSTTY_ENUM_MAX_VALUE as INT_MAX in types.h and add it as
the last entry in every enum in include/ghostty/vt/. This forces
the compiler to use int as the backing type, matching c_int on all
targets. INT_MAX is used rather than a fixed constant because enum
constants must be representable as int; values above INT_MAX are a
constraint violation in standard C.

Document this convention in AGENTS.md.
2026-04-08 10:34:52 -07:00