Commit Graph

17364 Commits

Author SHA1 Message Date
Mitchell Hashimoto
af150144e2 terminal: clear progress bar on full reset (#13901)
Emit a `progress_report` remove effect from the `full_reset` arm,
matching kitty and WezTerm which both clear progress on reset.

Previously, only the termio `StreamHandler` removed the progress bar on
RIS (#10178) - but the terminal stream handler used by `libghostty-vt`
did not, so an embedder's progress bar would outlive the reset.
2026-08-20 08:02:42 -07:00
Mitchell Hashimoto
956a687d63 macOS: refine liquid glass styles (#13928)
Rework for https://github.com/ghostty-org/ghostty/pull/10943;

Keep the background color as it is and apply glass effect on top of it.
Remove the color modification and keep our implementation relatively
simple and more straightforward.

This fixes https://github.com/ghostty-org/ghostty/issues/13914 and also
ofc the linked issue in previous pr.

### Regular


https://github.com/user-attachments/assets/b44e0af1-0a03-4773-8bfa-03ba48804235


https://github.com/user-attachments/assets/83ab0ef5-6791-412d-b260-e7c55e7f890c

### Clear


https://github.com/user-attachments/assets/8970b97c-7866-45dd-a122-dc9c8bdc7ec0


https://github.com/user-attachments/assets/4105dc8f-f531-4a77-b193-b914c46d3075
2026-08-20 06:57:16 -07:00
Mitchell Hashimoto
aea03011d0 termio: release initial input resources (#13931)
Initial input files remained open and their fully read buffers remained
allocated after queueWrite copied their contents. Close these files on
both startup success and failure, free their contents after queueing,
and borrow raw values already owned by the arena.

**AI Usage:** This was spotted by GPT 5.6 Sol. I reworked the code a bit
and understand it all.
2026-08-20 06:56:43 -07:00
Mitchell Hashimoto
0de91eee32 font: render glyf directly into output bitmap (#13929)
Glyf rasterization previously let z2d allocate its alpha surface, then
duplicated the completed pixels into caller-owned storage. Back the z2d
surface with the final bitmap instead, eliminating one allocation and a
full bitmap copy for each non-empty glyph.
2026-08-20 06:54:17 -07:00
Jon Parise
9566a1a87e termio: release initial input resources
Initial input files remained open and their fully read buffers remained
allocated after queueWrite copied their contents. Close these files on
both startup success and failure, free their contents after queueing, and
borrow raw values already owned by the arena.
2026-08-20 09:02:54 -04:00
Jon Parise
6f02d9aad6 font: render glyf directly into output bitmap
Glyf rasterization previously let z2d allocate its alpha surface, then
duplicated the completed pixels into caller-owned storage. Back the z2d
surface with the final bitmap instead, eliminating one allocation and a
full bitmap copy for each non-empty glyph.
2026-08-20 08:12:34 -04:00
Lukas
fd17869d15 macOS: rework for #10943
Keep the background color as it is and apply glass effect on top of it
2026-08-20 13:30:33 +02:00
Fredrik Fornwall
b7ee3ab6b3 Revert "terminal: only clear the progress bar on full reset if there is one"
This reverts commit b56c6d88f8.
2026-08-20 11:34:43 +02:00
Mitchell Hashimoto
9ae02a326f terminal: transfer selection text into string maps (#13923)
Selection strings previously duplicated formatted text when callers
requested a `StringMap`, even though the regex-link caller immediately
freed the returned copy.

Add a dedicated `selectionStringMap` path that transfers the formatter
output and pin map directly into the returned map. This removes the
extra allocation and copy while making ownership explicit.

**AI Usage:** GTP 5.6 Sol identified and implemented this opportunity. I
reviewed and understand it all.
2026-08-19 19:40:18 -07:00
Kris
fc5ac17a68 i18n: complete Dutch (nl) translation for v1.4 (#13853)
Fills the 181 untranslated strings in `po/nl.po`, bringing it to
252/252. Most of them are the command palette actions from
`src/input/command.zig`; the rest are the new context menu items, global
keybind notifications, and config editing strings.

**Style.** Ten of the new command palette strings had already been
translated by previous translators, and those settle the verb form, so
the rest follows them: imperative for verb+object action titles (`Split
Left` → `Splits naar links`, `Close Tab` → `Sluit tabblad`), noun
phrases left as noun phrases (`New Window` → `Nieuw venster`), no title
case, informal "je". Descriptions are full imperative sentences. Dialog
headings keep the noun-first infinitive form of the existing `Change
Terminal Title` → `Titel van de terminal wijzigen`.

A few translation notes:

- `ANSI Sequences` → `ANSI-reeksen` in titles, `ANSI escape sequences` →
`ANSI-escapereeksen` in descriptions, mirroring the distinction the
source makes.
- `Toggle X` titles use the idiomatic `X aan/uit`; their descriptions
stay imperative (`Schakel … in of uit.`).
- `surface` is rendered as `terminal` - the Dutch UI has no equivalent
concept.
- `scrollback` → `scrollbuffer`.

**No existing translation was modified.** The diff only touches empty
`msgstr` lines plus `PO-Revision-Date` and `Last-Translator`.

Checked with `msgfmt -c --statistics` (252 translated, no warnings, no
fuzzy) and `msgcat` (formatting is idempotent, so no rewrap noise for
the next translator). No `X-Generator` field added.

---------

Co-authored-by: Nico Geesink <126799020+nwehg@users.noreply.github.com>
2026-08-20 01:43:41 +00:00
Jon Parise
f1948d5054 terminal: transfer selection text into string maps
Selection strings previously duplicated formatted text when callers
requested a StringMap, even though the regex-link caller immediately
freed the returned copy.

Add a dedicated selectionStringMap path that transfers the formatter
output and pin map directly into the returned map. This removes the
extra allocation and copy while making ownership explicit.
2026-08-19 21:14:19 -04:00
Mitchell Hashimoto
9154efcbd3 macos: avoid temporary path component allocation (#13921)
The common directory helper previously allocated a temporary slice to
prepend the base directory before joining path components. Pass the
three known components directly to std.fs.path.join, leaving only the
allocation for the returned path.
2026-08-19 17:04:55 -07:00
Jon Parise
a436a9edcc macos: avoid temporary path component allocation
The common directory helper previously allocated a temporary slice to
prepend the base directory before joining path components. Pass the
three known components directly to std.fs.path.join, leaving only the
allocation for the returned path.
2026-08-19 19:31:18 -04:00
Mitchell Hashimoto
50d3ac8ed6 shell-integration: avoid owning temporary commands (#13919)
Some shell setup functions previously converted their stack-backed
command builders to owned sentinel slices before duplicating them into
the result arena. Duplicate the builders' written bytes directly
instead, avoiding unnecessary ownership transfer and sentinel handling.
2026-08-19 15:18:05 -07:00
Mitchell Hashimoto
49e503fd40 surface: parse text bindings with stack fallback (#13918)
Text binding actions previously allocated a temporary buffer for every
escaped string. Use a 256-byte stack fallback allocator so typical
bindings avoid the transient heap allocation while larger values
continue to use the existing heap-backed behavior.
2026-08-19 15:09:45 -07:00
Jon Parise
8e8d76b634 shell-integration: avoid owning temporary commands
Some shell setup functions previously converted their stack-backed
command builders to owned sentinel slices before duplicating them into
the result arena. Duplicate the builders' written bytes directly
instead, avoiding unnecessary ownership transfer and sentinel handling.
2026-08-19 17:46:14 -04:00
Jon Parise
a9f7f6d212 surface: parse text bindings with stack fallback
Text binding actions previously allocated a temporary buffer for every
escaped string. Use a 256-byte stack fallback allocator so typical
bindings avoid the transient heap allocation while larger values
continue to use the existing heap-backed behavior.
2026-08-19 17:36:43 -04:00
Mitchell Hashimoto
a4edca2a90 surface: keep clipboard content list on stack (#13916)
Use a two element stack-based buffer for the one or two ClipboardContent
entries rather than the (arena-based) heap allocator.
2026-08-19 14:19:56 -07:00
Mitchell Hashimoto
4d646bae0c macOS: group settings menu in a separate group (#13906)
**Reverted https://github.com/ghostty-org/ghostty/pull/13664 with a
second thought.**

This keeps the consistency with other first-party apps like Terminal,
Finder, and Music. It seems that most of the first-party apps show the
standard icons on macOS 27 for "Settings...", "Find", "AutoFill" and
etc., but in a separate group.

<img width="1060" height="375" alt="image"
src="https://github.com/user-attachments/assets/d3017865-a443-4c14-ace9-1c6b5acb3f56"
/>


I believe this still follows
[HIG](https://developer.apple.com/design/human-interface-guidelines/menus#Icons).
2026-08-19 14:11:28 -07:00
Jon Parise
5a8921ecb5 surface: keep clipboard content list on stack
Use a two element stack-based buffer for the one or two ClipboardContent
entries rather than the (arena-based) heap allocator.
2026-08-19 17:06:14 -04:00
trag1c
3e7230bf5d i18n: update pt_BR translations (#13819)
Update all missing Portuguese/BR translations for 1.4.

Part of https://github.com/ghostty-org/ghostty/issues/13766
2026-08-19 22:01:27 +02:00
Guilherme Tiscoski
959c0daeaa i18n: update revision date 2026-08-19 13:44:25 -05:00
Guilherme Tiscoski
e8a7097f65 i18: use "aplicativo" instead of "aplicação" for "application" 2026-08-19 11:57:49 -05:00
Guilherme Nandi Tiscoski
5a55a345aa Update po/pt_BR.po
Co-authored-by: Micael Jarniac <micael@jarniac.com>
2026-08-19 11:52:13 -05:00
Guilherme Nandi Tiscoski
4302020990 Update po/pt_BR.po
Co-authored-by: Micael Jarniac <micael@jarniac.com>
2026-08-19 11:52:04 -05:00
Guilherme Nandi Tiscoski
9581f7dd45 Update po/pt_BR.po
Co-authored-by: Micael Jarniac <micael@jarniac.com>
2026-08-19 11:51:56 -05:00
Guilherme Nandi Tiscoski
65621664ed Update po/pt_BR.po
Co-authored-by: Micael Jarniac <micael@jarniac.com>
2026-08-19 11:51:44 -05:00
Guilherme Nandi Tiscoski
ae7080e6cc Update po/pt_BR.po
Co-authored-by: Micael Jarniac <micael@jarniac.com>
2026-08-19 11:51:31 -05:00
Mitchell Hashimoto
d9ffbbf17c chore(vt): expose snapshot api (#13912)
Link:
https://discord.com/channels/1005603569187160125/1420009803173859449/1539649787748417667
2026-08-19 08:32:12 -07:00
Lukas
043abc7b60 macOS: group settings menu in a separate group 2026-08-19 15:03:15 +02:00
Lukas
f6990690f0 Revert "macOS: hide settings menu icon on macOS 27 (#13664)"
This reverts commit 99c483f477, reversing
changes made to 33bdeed1cb.
2026-08-19 15:02:01 +02:00
Mitchell Hashimoto
4c6215bb8e terminal: clear tabstop bit on unset instead of toggling (#13900)
Make `Tabstops.unset` (backing [Tab Clear
(TBC)](https://ghostty.org/docs/vt/csi/tbc) with `n=0`) not set a tab
stop when clearing a column that has no tab stop.
2026-08-18 17:58:55 -07:00
Fredrik Fornwall
b56c6d88f8 terminal: only clear the progress bar on full reset if there is one 2026-08-19 00:08:00 +02:00
Fredrik Fornwall
eeab85b967 terminal: clear progress bar on full reset
Emit a progress_report remove effect from the full_reset arm, matching
kitty and WezTerm which both clear progress on reset.

Previously, only the termio StreamHandler removed the progress bar on
RIS (ghostty#10178); the terminal stream handler used by libghostty-vt
did not, so an embedder's progress bar would outlive the reset.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2026-08-18 23:42:02 +02:00
Fredrik Fornwall
bed20eb364 terminal: clear tabstop bit on unset instead of toggling
Tabstops.unset used XOR, so unsetting a column without a tabstop set
one instead. This made TBC (CSI 0 g) and CTC (CSI 2 W) create a
tabstop at the cursor column when none existed.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
2026-08-18 23:11:07 +02:00
Mitchell Hashimoto
7f62fe70a2 terminal/kitty: preserve data on unmatched delete (#13898)
Make uppercase Kitty graphics deletes with a nonzero placement ID leave
the image intact when the named placement does not exist.

Previously, d=I,i=...,p=... could free unreferenced image data after
matching no placement. A later put then failed with ENOENT, diverging
from the protocol and Kitty.
2026-08-18 12:20:45 -07:00
Mitchell Hashimoto
fe12e30b34 terminal/kitty: preserve chunked response identifiers (#13897)
Chunked image responses used the final command even though only the
initial chunk carries the image and placement identifiers. Successful
replies lost image numbers and placement IDs. Final validation errors
could also be suppressed entirely.

Save the initial response identifiers with the in-progress image and use
them when the final chunk completes. Continue replacing the response ID
with the generated image ID after a successful load. Cover successful
image-number replies and invalid final payloads with unit tests.
2026-08-18 12:20:04 -07:00
Mitchell Hashimoto
72b6cd7124 terminal/kitty: validate graphics query image data (#13896)
Graphics query commands previously initialized their loading state but
returned success before completing the image load.

This allowed truncated, malformed, or otherwise invalid image data to
return OK, giving capability probes a false positive.

Complete and validate queried images through the normal load path, then
discard the result without modifying image storage. Add coverage for
invalid data and preserving an existing image with the queried ID.
2026-08-18 12:19:03 -07:00
Mitchell Hashimoto
306a169033 terminal/kitty: preserve data on unmatched delete
Make uppercase Kitty graphics deletes with a nonzero placement ID
leave the image intact when the named placement does not exist.

Previously, d=I,i=...,p=... could free unreferenced image data after
matching no placement. A later put then failed with ENOENT, diverging
from the protocol and Kitty.
2026-08-18 12:12:35 -07:00
Mitchell Hashimoto
86d94f150a terminal/kitty: preserve chunked response identifiers
Chunked image responses used the final command even though only the
initial chunk carries the image and placement identifiers. Successful
replies lost image numbers and placement IDs. Final validation errors
could also be suppressed entirely.

Save the initial response identifiers with the in-progress image and use
them when the final chunk completes. Continue replacing the response ID
with the generated image ID after a successful load. Cover successful
image-number replies and invalid final payloads with unit tests.
2026-08-18 12:10:47 -07:00
Mitchell Hashimoto
cfc5a96501 terminal/kitty: validate graphics query image data
Graphics query commands previously initialized their loading state but
returned success before completing the image load.

This allowed truncated, malformed, or otherwise invalid image data to
return OK, giving capability probes a false positive.

Complete and validate queried images through the normal load path, then
discard the result without modifying image storage. Add coverage for
invalid data and preserving an existing image with the queried ID.
2026-08-18 12:08:02 -07:00
Mitchell Hashimoto
2ced1e5c8e terminal/kitty: fix various graphics deletion mismatches with spec (#13895)
- Limit d=a/A to non-virtual placements that intersect the active
screen.
- Keep unrelated unplaced image data when processing d=A.
- Make d=R delete matching unused images even when they have no
placements, and default an omitted x bound to zero.
- Give ED2 a separate clear path that preserves scrollback references
while reclaiming every unreferenced image.

References:
- Spec:
https://sw.kovidgoyal.net/kitty/graphics-protocol/#deleting-images
- Delete reference implementation:
0ecb10d158/kitty/graphics.c (L2114-L2363)
- ED2 reference implementation:
0ecb10d158/kitty/screen.c (L2919-L2958)
2026-08-18 11:39:10 -07:00
Mitchell Hashimoto
f8b40a0235 terminal/kitty: fix various graphics deletion mismatches with spec
- Limit d=a/A to non-virtual placements that intersect the active screen.
- Keep unrelated unplaced image data when processing d=A.
- Make d=R delete matching unused images even when they have no
  placements, and default an omitted x bound to zero.
- Give ED2 a separate clear path that preserves scrollback references
  while reclaiming every unreferenced image.

References:
- Spec:
  https://sw.kovidgoyal.net/kitty/graphics-protocol/#deleting-images
- Delete reference implementation:
  0ecb10d158/kitty/graphics.c (L2114-L2363)
- ED2 reference implementation:
  0ecb10d158/kitty/screen.c (L2919-L2958)
2026-08-18 11:29:20 -07:00
Mitchell Hashimoto
55dac8fc47 terminal/kitty: abort incomplete graphics loads (#13893)
Previously, delete left partial bytes alive for the next upload, while
failed or incomplete retransmissions kept stale placements visible.

Abort incomplete chunked image uploads on delete commands and remove an
existing image and its placements when retransmission of an explicit ID
begins.
2026-08-18 11:06:05 -07:00
Mitchell Hashimoto
e5747cf0b6 terminal/kitty: abort incomplete graphics loads
Previously, delete left partial bytes alive for the next upload, while
failed or incomplete retransmissions kept stale placements visible.

Abort incomplete chunked image uploads on delete commands and remove an
existing image and its placements when retransmission of an explicit ID
begins.
2026-08-18 10:56:13 -07:00
Mitchell Hashimoto
364f8e9ac1 terminal/kitty: graphics S value is exact byte, not max (#13892)
File transmissions with exactly S bytes or trailing file data previously
failed because appendRemaining reports StreamTooLong when it reaches its
limit. This broke the protocol's partial-file transmission path.

Use an exact-length allocation and read when S is nonzero, rejecting
premature EOF and values above the image limit. Preserve the existing
bounded read-to-EOF behavior for S=0.

https://sw.kovidgoyal.net/kitty/graphics-protocol/#local-client
2026-08-18 10:53:15 -07:00
Mitchell Hashimoto
abd77067de terminal/kitty: graphics S value is exact byte, not max
File transmissions with exactly S bytes or trailing file data previously
failed because appendRemaining reports StreamTooLong when it reaches its
limit. This broke the protocol's partial-file transmission path.

Use an exact-length allocation and read when S is nonzero, rejecting
premature EOF and values above the image limit. Preserve the existing
bounded read-to-EOF behavior for S=0.

https://sw.kovidgoyal.net/kitty/graphics-protocol/#local-client
2026-08-18 10:40:34 -07:00
Mitchell Hashimoto
7e5dfa09eb terminal/kitty: constrain placement offsets to cell bounds (#13891)
Clamp X and Y offsets when a placement is created and normalize them
again against current cell geometry when sizing and rendering. The
protocol requires offsets to remain within the first cell and not
enlarge explicit c/r rectangles:

https://sw.kovidgoyal.net/kitty/graphics-protocol/#controlling-displayed-image-layout

Previously, explicit placements were sized to the full c/r rectangle
before the offset was applied. This extended their far edge into
neighboring cells and let unbounded offsets reach renderer geometry.
2026-08-18 10:31:53 -07:00
Mitchell Hashimoto
c5a3c7e2e5 terminal/kitty: constrain placement offsets to cell bounds
Clamp X and Y offsets when a placement is created and normalize them
again against current cell geometry when sizing and rendering. The
protocol requires offsets to remain within the first cell and not
enlarge explicit c/r rectangles:
https://sw.kovidgoyal.net/kitty/graphics-protocol/#controlling-displayed-image-layout

Previously, explicit placements were sized to the full c/r rectangle
before the offset was applied. This extended their far edge into
neighboring cells and let unbounded offsets reach renderer geometry.
2026-08-18 10:28:03 -07:00
Mitchell Hashimoto
9848cb15fa terminal/kitty: intersect source rectangles before sizing (#13890)
Kitty graphics placements previously calculated pixel and grid geometry
from requested source dimensions before intersecting them with the
image. The renderer clamped explicit dimensions later but treated
omitted source dimensions as the full image.

This stretched clipped crops into incorrectly sized destinations and
exposed inconsistent geometry through storage, rendering, and
libghostty.

Resolve the source rectangle once against the image bounds and reuse it
for placement sizing, renderer preparation, and the C API. Add
regression tests for omitted and explicit dimensions and renderer
geometry.

Spec:
https://sw.kovidgoyal.net/kitty/graphics-protocol/#controlling-displayed-image-layout
Reference:
0ecb10d158/kitty/graphics.c (L1225-L1240)
2026-08-18 10:24:50 -07:00