Commit Graph

16730 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
1cc5e7bec1 update zig-gobject to 0.3.2
Includes better ZIg 0.16 compat and updates for Gnome 50.
2026-07-28 15:52:01 -05:00
ghostty-vouch[bot]
232d40c062 Update VOUCHED list (#13499)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13498#issuecomment-5109104876)
from @mitchellh.

Vouch: @vegerot

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-28 20:07:22 +00:00
ghostty-vouch[bot]
7bea975bd3 Update VOUCHED list (#13497)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13458#discussioncomment-17817388)
from @jcollie.

Vouch: @RoniJacobson

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-28 19:46:53 +00:00
Mitchell Hashimoto
4133c6e48c mirror deps (#13496) 2026-07-28 09:22:54 -07:00
Mitchell Hashimoto
07f6c6bb07 mirror deps 2026-07-28 09:13:49 -07:00
Mitchell Hashimoto
03eaa01d48 terminal: add visibility reports with GTK suspension tracking (#13494)
## Summary

Applications cannot reliably determine whether an unfocused terminal is
still
visible, so focus reports alone are insufficient for avoiding
unnecessary
rendering.

This adds terminal visibility reporting by:

- implementing private mode 2033
- supporting `CSI ? 998 n` visibility queries and `CSI ? 999 ; Ps n`
responses
- reporting effective visibility changes while mode 2033 is enabled
- preserving host-owned visibility state across terminal resets
- treating unknown visibility conservatively as potentially visible

On GTK 4.12 and newer, surface visibility now combines widget mapping
with the
toplevel `suspended` state. This allows Ghostty to recognize windows
hidden on
another workspace or otherwise known by the compositor to be
non-visible.
Older GTK versions retain the existing conservative behavior.

## Testing

Added coverage for:

- mode 2033 support and enable/disable behavior
- explicit visibility queries
- immediate reports when enabling the mode
- visible and non-visible responses
- visibility persistence across terminal resets
- suppression of visibility queries in read-only mode

## AI disclosure

Amp assisted with the implementation, tests, commit messages, and this
pull
request description. I reviewed the resulting changes and understand how
they
interact with the terminal, termio, surface, and GTK visibility paths.

Implements: #13451 
Reference: https://rockorager.dev/misc/visibility-reports/
2026-07-28 09:13:43 -07:00
Tim Culverhouse
6c8c07981d terminal: add visibility reports
Applications cannot infer whether an unfocused terminal remains visible, so
focus reports are insufficient for avoiding expensive rendering while a
view is hidden.

Implement private mode 2033 and the visibility query/report sequences.
Track conservative per-surface visibility, report every effective change
while enabled, and always answer explicit queries and mode enables. Keep
view visibility across terminal resets because it is owned by the host,
not terminal state.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019fa965-aa5f-7099-85b4-a9679d2c8bd3
2026-07-28 11:04:13 -05:00
Tim Culverhouse
2f3814ca5e gtk: honor suspended window state
GTK exposes the Wayland xdg_toplevel suspended state when the
compositor knows a window is not visible. Ghostty previously only used
widget map state, so it could continue rendering a mapped surface on an
inactive workspace or behind other windows.

Combine the mapped and suspended states for surface occlusion and update
all displayed surfaces whenever the toplevel suspension state changes.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019fa965-aa5f-7099-85b4-a9679d2c8bd3
2026-07-28 10:47:58 -05:00
ghostty-vouch[bot]
95befb3377 Update VOUCHED list (#13495)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13491#discussioncomment-17814823)
from @tristan957.

Vouch: @ruseel

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-28 15:12:57 +00:00
Jeffrey C. Ollie
6e21f41c0c cli: fix list-themes preview lifecycle (#13466)
Start the vaxis event loop so the theme preview can receive terminal
input, and retain its environment map for as long as vaxis may access
it.
2026-07-28 09:21:34 -05:00
Mitchell Hashimoto
74f45b3219 config: update info about global keybinds on Linux (#13492) 2026-07-28 06:10:42 -07:00
Jon Parise
d320cd7df2 cli: fix list-themes preview lifecycle
Start the vaxis event loop so the theme preview can receive terminal
input, and retain its environment map for as long as vaxis may access
it.
2026-07-28 06:21:58 -04:00
Leah Amelia Chen
d71695550d config: update info about global keybinds on Linux 2026-07-28 13:26:08 +08:00
Mitchell Hashimoto
a60cd15bb5 renderer/metal: fix 2x sizeof over-allocation in Buffer.sync (#13490)
Seems to me the grow path in `Buffer.sync` (and `syncFromArrayLists`)
multiplies by `@sizeOf(T)` twice: `req_bytes` is already a byte count,
it gets doubled into size, and then the `newBufferWithLength:` call does
`size * @sizeOf(T)` on top of that. So every reallocation ends up being
`data.len` × `@sizeOf(T)`^2 × 2 bytes instead of the intended `data.len`
× `@sizeOf(T)` × 2.

The OpenGL version of this same helper does it what seems to be the
intended way, so this looks like a mixup rather than a deliberate safety
margin.

This makes the Metal implementation match the OpenGL one: track the new
length in units of T (which also fixes self.len going stale after a
grow. It's documented as the allocated element count but was never
updated here)
2026-07-27 19:55:34 -07:00
Uzair Aftab
4a22eed6d9 renderer/metal: fix 2x sizeof over-allocation in Buffer.sync
Buffer.sync and Buffer.syncFromArrayLists computed the new buffer size
in bytes (req_bytes * 2) and then multiplied by @sizeOf(T) again when
passing it to newBufferWithLength:, allocating data.len * sizeOf(T)^2 * 2
bytes. For the 32-byte CellText buffers this is a 64x over-allocation
and for the 4-byte CellBg buffers 8x, per swap-chain frame (e.g. ~9.4MB
instead of ~300KB per frame for a full 120x40 screen of text).

Match the OpenGL buffer implementation: track the new length in units
of T and multiply by @sizeOf(T) exactly once.
2026-07-27 23:42:06 +02:00
Mitchell Hashimoto
2dd79f3bc6 Expose additional events: desktop and progress (#13483)
This exposes libghostty-vt callbacks for additional terminal events.

* Desktop notifications from OSC 9/777
* Progress reports from OSC 9;4, including state and optional percentage
* Uses the `lib.Enum` progress state
* Exposes both through the existing terminal option/effect API

AI disclosure: Sol-5.6 was used extensively to write the code, I
reviewed it personally.
2026-07-27 13:22:01 -07:00
Mitchell Hashimoto
eb9faed28b font/sprite: update to z2d 0.12.1, use native path insetting (#13489)
This change updates z2d to 0.12.1 and changes the sprite font path
insetting functionality to use the new path offset abilities released in
the update.

In addition, there has been a slight change to the drawing of E0B5 and
its respective reflection; we now add a 1-pixel horizontal line segment
to each end to force them to be perpendicular. This is because
offsetting pre-expands the curves and ultimately causes the end segments
of the curve itself to have slight non-horizontal angles, which produce
small artifacts at the ends without the forced horizontal ends.
2026-07-27 13:20:50 -07:00
Chris Marchesi
d0e72a3ab6 font/sprite: update to z2d 0.12.1, use native path insetting
This change updates z2d to 0.12.1 and changes the sprite font path
insetting functionality to use the new path offset abilities released in
the update.

In addition, there has been a slight change to the drawing of E0B5 and
its respective reflection; we now add a 1-pixel horizontal line segment
to each end to force them to be perpendicular. This is because
offsetting pre-expands the curves and ultimately causes the end segments
of the curve itself to have slight non-horizontal angles, which produce
small artifacts at the ends without the forced horizontal ends.
2026-07-27 12:08:24 -07:00
Jeffrey C. Ollie
c14cb5196a GhosttyI18n: fix build on freebsd with zig 0.16 (#13485) 2026-07-27 13:11:39 -05:00
Jack Pearkes
2729996eab terminal: update event tests for constructor API 2026-07-27 13:19:37 -04:00
Jack Pearkes
628adaf30f terminal: share progress state enum 2026-07-27 13:19:37 -04:00
ghostty-vouch[bot]
28f02ac3ce Update VOUCHED list (#13487)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13485#issuecomment-5094118020)
from @jcollie.

Vouch: @svmhdvn

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-27 16:44:59 +00:00
Siva Mahadevan
10e6ace6b6 GhosttyI18n: fix build on freebsd with zig 0.16 2026-07-27 12:40:20 -04:00
Jack Pearkes
47d602c422 terminal: expose progress report effect 2026-07-27 12:16:28 -04:00
Jack Pearkes
c3655ba258 terminal: expose desktop notification effect 2026-07-27 12:16:09 -04:00
Mitchell Hashimoto
5a35415a5d libghostty: scrollback limits can be changed at runtime (#13481)
**This is an ABI breaking change for C libs.**

Fixes https://github.com/ghostty-org/ghostty/issues/13268

You can now change scrollback limits (bytes and lines) at runtime. 

This breaks the ABI but makes for a much more long-term pattern:
`ghostty_terminal_new` now only takes viewport size, and you set
scrollback configurations with the generic `ghostty_terminal_set`. The
`GhosttyTerminalOptions` struct is fully removed. I think this will
serve us much better over the long term.
2026-07-27 08:11:59 -07:00
Mitchell Hashimoto
5fd2973b9a lib-vt: better docs for C options 2026-07-27 08:09:30 -07:00
Mitchell Hashimoto
a27e04e8f9 lib-vt: readers for configured scrollback limits
C API callers could configure runtime scrollback limits but could not
read them back. Add terminal data keys for the primary screen byte and
line configurations.

Return GHOSTTY_NO_VALUE for unlimited limits and keep reads stable while
an alternate screen is active. Document the configured-value semantics
and add focused coverage for defaults, updates, and unlimited values.
2026-07-27 07:14:52 -07:00
Mitchell Hashimoto
03d5fa2689 lib-vt: move scrollback limits to terminal_set
Terminal construction previously accepted GhosttyTerminalOptions with
dimensions and one scrollback byte limit. Remove the options struct from
the ABI and make ghostty_terminal_new accept columns and rows directly.

Add byte and line limit options to ghostty_terminal_set and forward them
to the runtime Terminal setters. NULL removes a limit, while zero bytes
disables scrollback. Update type metadata, tests, and all API examples.
2026-07-27 07:14:40 -07:00
Mitchell Hashimoto
f4c68d65e5 terminal: support runtime scrollback limits
Scrollback limits were fixed when a terminal screen was initialized.
Move byte and line state and enforcement into a shared Limits type so
PageList can update both constraints after initialization and resize.

Add runtime setters to PageList and Terminal. Lowering a limit prunes
eligible history immediately, while zero bytes switches the primary
screen to no-scrollback behavior and clears retained history. Keep
alternate screens unchanged.
2026-07-27 07:02:39 -07:00
Mitchell Hashimoto
739603b8a2 Introduce scrollback-limit-lines to limit scrollback by lines instead of bytes (#13473)
This adds a new config `scrollback-limit-lines` to limit scrollback by
lines instead of bytes. This also renames `scrollback-limit` to
`scrollback-limit-bytes` to make it clear what it does but we have a
compatibility entry so old configurations will continue to work, so its
not breaking.

**This is NOT exclusive to `scrollback-limit-bytes`**. When both are
set, then the _first limit reached_ is used. Since lines is affected by
viewport size and bytes are affected by entries (more styles, more
graphemes, etc.), they serve somewhat different purposes and it might be
useful to set both.

The default remains 50MB of bytes, unlimited lines.

This is not exposed to libghostty yet. I have that coming as a follow up
change.
2026-07-27 05:57:27 -07:00
Mitchell Hashimoto
659a60ae53 terminal/search: fix tests 2026-07-26 20:28:58 -07:00
Mitchell Hashimoto
1092204df1 config: support unlimited scrollback limits 2026-07-26 20:13:45 -07:00
Mitchell Hashimoto
65c48213b6 config: expose scrollback line limit 2026-07-26 20:13:45 -07:00
Mitchell Hashimoto
10bc43420c terminal: make scrollback byte limit optional 2026-07-26 20:13:45 -07:00
Mitchell Hashimoto
86f81fb5b1 terminal: expose scrollback line limit 2026-07-26 20:13:45 -07:00
Mitchell Hashimoto
5b2d3b7df1 terminal: limit scrollback by physical lines 2026-07-26 20:13:45 -07:00
Mitchell Hashimoto
24f7fb9835 build: fix static libghostty-vt linking on Windows (#13452)
This PR fixes static linking for libghostty-vt on Windows by propagating
a couple of missing dependencies (discovered while running Neovim's Zig
build, see [this CI
run](https://github.com/neovim/neovim/actions/runs/30130848061/job/89604799965?pr=39773)).
2026-07-26 15:40:29 -07:00
Mitchell Hashimoto
82e53e3f6e deps: update translate-c backport (#13454)
Was brought up as possibly being a build issue here:
https://codeberg.org/vancluever/translate-c/pulls/1

I do think that this is the better approach and seems to be the close
equivalent of the `.zig_ilb` option that's coming with `LazyPath` in
0.17.0 (which is how translate-c behaves there).

I was looking for something like this initially and I _think_ I might
have passed over it to start with because it was a bit hard to determine
the circumstances that `b.graph.zig_lib_directory` would be null, but
upon further examination, I think such cases would be rare if they
happened at all. Rather than default to the cwd in this event though I
just get it to error out - that way we'll know if it ever is the case!
2026-07-26 15:39:58 -07:00
Mitchell Hashimoto
3b4600014c clarify comments 2026-07-26 15:38:19 -07:00
Riccardo Mazzarini
84254a9d8c build: avoid MSVC C++ runtime in no-libcxx builds
AI-assisted: Codex
2026-07-26 15:36:54 -07:00
Riccardo Mazzarini
1fe1b2d23c build: fix static libghostty-vt linking on Windows
This PR fixes static linking for libghostty-vt on Windows by propagating
a couple of missing dependencies (discovered while running Neovim's Zig
build, see
https://github.com/neovim/neovim/actions/runs/30130848061/job/89604799965?pr=39773).
2026-07-26 15:36:54 -07:00
Mitchell Hashimoto
40ab02e338 lib-vt: handle DECRQSS (#13471)
Move DECRQSS response encoding into the terminal DCS handler so both the
full termio path and libghostty-vt terminal stream emit the same
replies. The C API stream now maintains and releases DCS parser state
and forwards responses through write_pty.
2026-07-26 15:21:27 -07:00
Mitchell Hashimoto
39ae85f040 lib-vt: handle DECRQSS
Move DECRQSS response encoding into the terminal DCS handler so both
the full termio path and libghostty-vt terminal stream emit the same
replies. The C API stream now maintains and releases DCS parser state
and forwards responses through write_pty.
2026-07-26 15:04:16 -07:00
Mitchell Hashimoto
1ce5d4229e Revert "macOS: fix undo new tab will cause a crash (#9512)" (#13467)
We don't need this anymore after #13364
2026-07-26 14:50:06 -07:00
Mitchell Hashimoto
edcb6fb509 memset should match the C ABI (#13469)
The custom memset accepted its fill value as u8 even though C callers
pass int. Accept c_int and explicitly truncate it to the low byte, which
is what other implementations of this do.
2026-07-26 14:49:54 -07:00
Mitchell Hashimoto
6f10ddfe83 terminal: preserve underline style in DECRQSS (#13470)
DECRQSS previously serialized every active underline as SGR 4, which
caused double, curly, dotted, and dashed styles to round-trip as single
underlines.

Emit the 4:n form for extended underline styles while retaining the
legacy 4 form for single underlines, and cover every supported style.
2026-07-26 14:43:36 -07:00
Mitchell Hashimoto
be3d4a5335 terminal: avoid reallocating tabstop storage (#13465)
Avoid redundant tabstop allocation when the current buffer already
satisfies the requested size
2026-07-26 14:43:14 -07:00
Mitchell Hashimoto
8374aa7850 Update iTerm2 colorschemes (#13461)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20260720-153658-97e244c
2026-07-26 14:42:09 -07:00
Mitchell Hashimoto
1eecfe089f macOS: free surface synchronously in deinit on main thread (#13364)
Since the renderer thread now emits scrollbar events on almost every
frame, there's always a `.scrollbar` message for the dying surface in
the app mailbox.

The OS runtime seems to schedule `appTick` and `ghostty_surface_free`
differently across macOS pre-26, 26 and 27.

On macOS 26.x, `ghostty_app_free` happens after
`App.scrollbar(_:target:v:)`, leaving `surface.userdata` pointing at a
freed `SurfaceView`.

When `deinit` runs on the main thread, free the surface synchronously
instead of detaching to a task. This fixes both crashes mentioned in
https://github.com/ghostty-org/ghostty/pull/9512 and
https://github.com/ghostty-org/ghostty/issues/13359.

### AI Disclosure 

I used Claude to analyze the backtrace, but the code is written and
tested by myself.
2026-07-26 14:42:00 -07:00