Commit Graph

12787 Commits

Author SHA1 Message Date
Mitchell Hashimoto
a19aa0a398 terminal: OSC 104 with no semicolon should parse as reset palette
https://github.com/ghostty-org/ghostty/pull/8590#issuecomment-3287418867
2025-09-12 21:10:07 -07:00
Mitchell Hashimoto
b5c8c83468 macOS 26: Always set titlebarview background color for transparent title (#8611)
This fixes an issue where new tabs would not have the proper transparent
background set whilst in native fullscreen. This is because in native
fullscreen, the NSTitlebarView always is visible, so our guard was
preventing us from setting it before.
2025-09-12 20:49:30 -07:00
Mitchell Hashimoto
d813d82da1 macOS 26: Always set titlebarview background color for transparent title
This fixes an issue where new tabs would not have the proper transparent
background set whilst in native fullscreen. This is because in native
fullscreen, the NSTitlebarView always is visible, so our guard was
preventing us from setting it before.
2025-09-12 20:41:02 -07:00
Mitchell Hashimoto
bbf03cfa07 macOS 26: always reset titlebar tab constraints on frame change (#8610)
Fixes #8595

Whenever the titlebar frame changes, we should set up our constraints
again to force it to re-render properly.
2025-09-12 20:40:53 -07:00
Mitchell Hashimoto
eaaf5aa8cf macos: always reset titlebar tab constraints on frame change
Fixes #8595

Whenever the titlebar frame changes, we should set up our constraints
again to force it to re-render properly.
2025-09-12 20:14:31 -07:00
Mitchell Hashimoto
da7e3d1882 deps/ci: Use Ghostty-specific themes release (#8609)
Closes #8608 
iterm2_themes now provides terminal-specific releases, this reduces the
size of the dependency from 55MB->53kB.
- Update the `.github/workflows/update-colorschemes.yml` to track the
latest release and fetch the ghostty-specific theme archive.
2025-09-12 14:45:02 -07:00
azhn
ffa54dceea Update .github/workflows/update-colorschemes.yml to track the latest release and update the ghostty-specific download 2025-09-13 07:17:00 +10:00
azhn
928f5492dc Fix name of check-zig-cache.sh in documentation for updating the zig cache hash 2025-09-13 06:54:56 +10:00
azhn
e0350aa13f nix: update build.zig.zon.nix build.zig.zon.txt build.zig.zon.json flatpak/zig-packages.json 2025-09-13 06:53:18 +10:00
azhn
ac07cf5270 Use ghostty-specific themes release 2025-09-13 06:52:44 +10:00
Mitchell Hashimoto
74b204b6ce ci: disable trigger-snap for PRs (#8601)
Fixes #8568

This will hide snap issues from PRs which is not ideal but we can
address that in the future. We still run snap CI for main.

This more importantly ensures that CI can be green for maintainers to
merge.
2025-09-12 07:34:59 -07:00
Mitchell Hashimoto
dc7bf7e71f ci: disable trigger-snap for PRs
Fixes #8568

This will hide snap issues from PRs which is not ideal but we can
address that in the future. We still run snap CI for main.
2025-09-12 07:29:44 -07:00
Mitchell Hashimoto
db24f9715b Position-independent font shaper caching (#8555)
Use relative cluster positioning to allow identical texts runs in
different row positions to share the same cache entry.

I am opening this PR clean w/o the cache size change. There could be
some benefit to a larger 256->512 shaper cache, but this still performs
amazingly well and I don't know the full memory impacts of moving the
cache size up.


https://github.com/ghostty-org/ghostty/discussions/8547#discussioncomment-14329590
2025-09-12 07:27:21 -07:00
Mitchell Hashimoto
a8c3186658 macos 26: fix visual glitches with moving tabs and titlebar tabs (#8594)
This is a hacky fix to fix some visual glitches when titlebar tabs is on
and we're using the `move_tab` keybinding action (I test via the command
palette).

There is probably a more graceful way to fix this but this might be good
enough for a 1.2 to fix a very obviously nasty UI render.
2025-09-11 14:57:07 -07:00
Mitchell Hashimoto
09246780bb macos 26: fix visual glitches with moving tabs and titlebar tabs
This is a hacky fix to fix some visual glitches when titlebar tabs is on
and we're using the `move_tab` keybinding action (I test via the command
palette).

There is probably a more graceful way to fix this but this might be good
enough for a 1.2 to fix a very obviously nasty UI render.
2025-09-11 14:51:01 -07:00
Mitchell Hashimoto
7f3ee19225 macos: run change title dialog in a sheet modal (#8592)
This fixes a macOS 26 issue where the OK button would not be visible. 

This MUST be an AppKit bug, but I'm trying to find workarounds.
2025-09-11 14:49:15 -07:00
Mitchell Hashimoto
22ec755e75 macos: run change title dialog in a sheet modal
This fixes a macOS 26 issue where the OK button would not be visible. 

This MUST be an AppKit bug, but I'm trying to find workarounds.
2025-09-11 14:40:25 -07:00
Mitchell Hashimoto
5936987e71 macOS: grab text field focus of command palette after tick (#8591)
Fixes #8497

This works on every other supported version of macOS but doesn't work on
macOS tahoe. Putting it on the next event loop tick works at least on
Sequoia and Tahoe so let's just do that.
2025-09-11 14:24:41 -07:00
Mitchell Hashimoto
c9574ed0c7 macOS: grab text field focus of command palette after tick
Fixes #8497

This works on every other supported version of macOS but doesn't work on
macOS tahoe. Putting it on the next event loop tick works at least on
Sequoia and Tahoe so let's just do that.
2025-09-11 14:14:14 -07:00
Mitchell Hashimoto
3d6207e88c deps: update z2d to v0.8.1 (#8588)
Release notes at:
  https://github.com/vancluever/z2d/blob/v0.8.1/CHANGELOG.md

Small release again, just keeping up to date with releases in
anticipation of the Ghostty 1.2.0 release.
2025-09-11 12:41:45 -07:00
Mitchell Hashimoto
2b24ac53f1 xterm color operations compatibility and rewrite (#8590)
Replaces #7952
Fixes #7951 

This reimplements our color operation parsing completely to make it
fully compatible (as far as I can tell) with xterm. Our previous
implementation had numerous problems, I think because we kept addressing
singular compatibility issues as they were experienced in the field
rather than doing a proper thoughtful audit compared to the xterm
implementation. This PR does that audit.

**Specifically, this updates/adds: OSC 4, 5, 10-19, 104, 105, 110-119.**

To ease maintenance, understanding, and testing, I've pulled color
operation parsing out into a separate file and function that operates on
the full buffered OSC command. This is similar to Kitty protocols
previously. This hurts performance but that's acceptable to me for now
while we get compatibility down and test coverage added.

We can address more performance later if it becomes a bottleneck, but
these color operations are pretty rare.

I've associated each test with a `printf` command you can run in xterm
to compare.

## Xterm Divergence

We purposely diverge from xterm in some scenarios:

- Whitespace is allowed around x11 color names. Kitty allows this.
- Invalid index values for 104/105 are ignored. xterm typically halts
processing. Kitty allows this.

## TODO

- [x] Update our parser to use the new color parsing functions
- [x] Update the stream handler to use the new types
- [x] Fix our stream handler to emit on response per query
2025-09-11 12:38:52 -07:00
Mitchell Hashimoto
3afc8019d5 terminal: update parser to use new color parser and stream handler 2025-09-11 12:32:31 -07:00
Mitchell Hashimoto
67b7a5f267 terminal: osc 104/105 are more flexible on invalid index 2025-09-11 11:38:45 -07:00
Mitchell Hashimoto
03e2a8049e terminal: remove old color tests 2025-09-11 11:34:17 -07:00
Mitchell Hashimoto
4350804f0a terminal: osc 10-19 should use next function 2025-09-11 11:27:26 -07:00
Mitchell Hashimoto
83dd578cc5 terminal: osc 104/105 2025-09-11 11:20:54 -07:00
Mitchell Hashimoto
d7523e3e37 terminal: OSC 10-19 2025-09-11 11:12:03 -07:00
Mitchell Hashimoto
b4fdefc2c0 terminal: OSC 4/5 matches xterm 2025-09-11 10:58:55 -07:00
Chris Marchesi
8b56f80e56 deps: update z2d to v0.8.1
Release notes at:
  https://github.com/vancluever/z2d/blob/v0.8.1/CHANGELOG.md

Small release again, just keeping up to date with releases in
anticipation of the Ghostty 1.2.0 release.
2025-09-11 10:16:52 -07:00
Mitchell Hashimoto
aba8981d28 terminal: make dedicated OSC parsing, do dynamic resets 2025-09-11 10:08:43 -07:00
Mitchell Hashimoto
4717f8d22b terminal: special/dynamic color enums 2025-09-11 07:35:32 -07:00
Mitchell Hashimoto
dccefc288f Add default bindings for the "copy" and "paste" keyboard keys. (#8586)
These keys are present in some old unix keyboards, but more importantly,
their keycodes can be mapped to physical keys in modern programmable
keyboards.
Using them in Linux is a way to be able to have the same keys for
copy/pasting in GUI apps and in terminal apps instead of switching
between ctrl-c/ctrl-v and ctrl-shift-c/ctrl-shift-v.
2025-09-11 07:33:27 -07:00
Jacob Sandlund
4d37853f6c benchmark sources 2025-09-11 10:30:01 -04:00
Yaacov Akiba Slama
b4ecadf2e9 Add default bindings for the "copy" and "paste" keyboard keys.
These keys are present in some old unix keyboards, but more importantly,
their keycodes can be mapped to physical keys in modern programmable
keyboards.
Using them in Linux is a way to be able to have the same keys for
copy/pasting in GUI apps and in terminal apps instead of switching between
ctrl-c/ctrl-v and ctrl-shift-c/ctrl-shift-v.
2025-09-11 12:17:49 +03:00
Kat
eb8767bb3b i18n: update ja_JP translations (#8479)
Update Japanese translation for Ghostty 1.2. Part of #8344
2025-09-11 06:10:56 +00:00
Mitchell Hashimoto
d83a4dc82d macos: update Sparkle to 2.7.3 (#8584)
Fixes some critical issues.
2025-09-10 20:13:57 -07:00
Mitchell Hashimoto
83024e08bc macos: update Sparkle to 2.7.3
Fixes some critical issues.
2025-09-10 20:04:24 -07:00
Misairuzame
5aac5a764b i18n: add Italian translation (#7074) 2025-09-10 18:17:48 +00:00
Jacob Sandlund
8a40c1f59f Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-10 10:01:06 -04:00
Mitchell Hashimoto
0dc324607d terminal: fix test w/ freed config (#8576)
this test previously didn't fail when accessing freed members of config
because deiniting `command_arena` was a no-op; `command_arena` was
derived from `arena`, which allocated memory after `command_arena` was
created/used
2025-09-09 14:07:03 -07:00
Cheru Berhanu
be6cb0f6ce terminal: fix test w/ freed config
this test previously didn't fail when accessing freed members of config
because deiniting `command_arena` was a no-op; `command_arena` was derived
from `arena`, which allocated memory after `command_arena` was created/used
2025-09-09 12:31:49 -05:00
Lon Sagisawa
85b149a2aa Update po/ja_JP.UTF-8.po
Co-authored-by: Takayuki Nagatomi <tnagatomi@okweird.net>
2025-09-10 02:02:26 +09:00
Jacob Sandlund
cffa52e658 changes after benchmarking 2025-09-09 11:38:10 -04:00
Mitchell Hashimoto
e7c1b4dd05 benchmarks: Align buf to cache line for consistency (#8569)
This aligns the `buf` of `4096` bytes in the benchmarks to the cache
line, to ensure a consistent number of cache lines are used, and also to
avoid any sub-`usize` alignment issues as seen in
https://github.com/ghostty-org/ghostty/pull/8548.

This has less of an effect as
https://github.com/ghostty-org/ghostty/pull/8548, and looking at the
before and after of the current benchmarks in the repo doesn't show any
noticeable difference.

In my case, I've been comparing the `table` option with [uucode in this
branch](https://github.com/ghostty-org/ghostty/compare/main...jacobsandlund:jacob/uucode?expand=1),
and I did see a difference.

### Before

I ran the before code several times (6 with the exact same binary, but
several more with essentially the same code), always getting something
like this, with `table` edging out `uucode` by something like 3-4ms:

```
Benchmark 1: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=table
  Time (mean ± σ):     927.8 ms ±   1.3 ms    [User: 883.7 ms, System: 42.5 ms]
  Range (min … max):   926.0 ms … 929.8 ms    10 runs

Benchmark 2: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=uucode
  Time (mean ± σ):     930.9 ms ±   1.4 ms    [User: 886.8 ms, System: 42.5 ms]
  Range (min … max):   928.5 ms … 933.4 ms    10 runs
```

### After

After this change, it shows `uucode` coming in at 10-11ms (~1%) faster:

```
Benchmark 1: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=table
  Time (mean ± σ):     930.6 ms ±   1.3 ms    [User: 886.5 ms, System: 42.4 ms]
  Range (min … max):   928.9 ms … 932.4 ms    10 runs

Benchmark 2: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=uucode
  Time (mean ± σ):     920.1 ms ±   1.4 ms    [User: 876.3 ms, System: 42.1 ms]
  Range (min … max):   918.4 ms … 923.3 ms    10 runs

Summary
  zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=uucode ran
    1.01 ± 0.00 times faster than zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=table
```

This ~1% faster time checks out, since from looking at the assembly,
it's an exact match minus this small place where the compiler can
optimize `uucode` a little better:

```
# both table.asm/uucode.asm:

   140                     const high = cp >> 8;
   141                     const low = cp & 0xFF;
** 142                     return self.stage3[self.stage2[self.stage1[high] + low]];

<+464>: ubfx   x12, x11, #8, #13
<+468>: ldrh   w12, [x27, x12, lsl #1]
<+472>: add    x11, x28, w11, uxtb #1
<+476>: ldrh   w11, [x11, x12, lsl #1]

# table.asm:

<+480>: lsl    x11, x11, #1

** 158                             table.get(@intCast(cp)).width);
   159                     }
   160                 }

<+484>: ldrb   w11, [x22, x11]

# uucode.asm:

** 148                 return @field(data(stages, cp), name);

<+480>: ldrh   w11, [x22, x11, lsl #1]
```

### More confusion with showing addresses

Confusingly, when I added `std.debug.print("buf addr={}\n",
.{@intFromPtr(&buf)})` to show the addresses, this somehow made the
`before` case show `uucode` as being faster. Then, when I added
alignment, `uucode` and `table` were taking about the same time
(**edit:** _uucode was only ~4 ms faster, but see more in "Edit: more
investigation"_)

If I run without the `std.debug.print` and with `--show-output`, the
times are different, so just making a note of this.

```
Benchmark 1: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=table
  Time (mean ± σ):     904.2 ms ±   1.2 ms    [User: 884.6 ms, System: 40.3 ms]
  Range (min … max):   902.8 ms … 906.1 ms    10 runs

Benchmark 2: zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=uucode
  Time (mean ± σ):     892.7 ms ±   2.0 ms    [User: 873.2 ms, System: 40.1 ms]
  Range (min … max):   887.9 ms … 895.6 ms    10 runs

Summary
  zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=uucode ran
    1.01 ± 0.00 times faster than zig-out/bin/ghostty-bench +codepoint-width --data=data.txt --mode=table
```

I think, even with this confusing case, aligning is going to be more
consistent than not.

### Edit: more investigation

I wasn't satisfied with the discovery that adding `std.debug.print` made
this difference and I wanted to dig in and figure out exactly what's
going on, but I didn't get a satisfactory answer. Here's what I tried:

* I compared the un-aligned addresses from `stepTable` and `stepUucode`,
but both seemed similar (not aligned to 128, different each run, but
aligned to 8). Note though that `uucode` was running ~1% faster still,
similar to the aligned case even though here it was un-aligned.
* Instead of doing `std.debug.print` in the step function, I printed in
teardown, just in case. This had no difference in the unaligned case,
but with alignment it brought the ~4 ms faster `uucode` (as noted above)
back closer to the original "after" at around 11-12 ms faster (~1%).
* I forced the `buf` in `stepUucode` to not be aligned (e.g. by making
it `= other_aligned_buf[3..4096 + 3]`). Still it was ~1% faster.
* I compared the assembly of `stepTable` and `stepUucode` for both
aligned and not aligned cases, including doing a diff of the diff of
these two across aligned and not aligned. The only difference between
`stepTable` and `stepUucode` is what's noted above, and nothing stood
out in the double diff.
* I tried going back to the original un-aligned non-printing code, but
then swapped the lines that get from `table` or `uucode`, so that
`stepTable` and `stepUucode` were actually doing the opposite. And the
result is`stepTable` (actually `uucode`) was 10-11 ms (~1%) faster, just
like the aligned case!

In summary, I wasn't able to replicate the original benchmark behavior
_and print out buffer addresses that pointed to alignment being the
issue_. I still feel like in theory aligning the buffer ought to make
the benchmark more reliable, and indeed the original un-aligned version
gives the result that is more of an outlier, but the evidence here is
weak, so I'm alright if we stick with the status quo and close. I think
a lesson here is benchmarks are hard to get precise.
2025-09-09 07:25:36 -07:00
Jacob Sandlund
7a1865080f Merge remote-tracking branch 'upstream/main' into jacob/uucode 2025-09-09 08:19:53 -04:00
Jacob Sandlund
77b4c52634 [benchmarks] Align buf to cache line for consistency 2025-09-08 17:59:17 -04:00
Mitchell Hashimoto
cd6820eb93 deps: update z2d to v0.8.0 (#8566)
Release notes at:
  https://github.com/vancluever/z2d/blob/v0.8.0/CHANGELOG.md

This is a small update and likely contains nothing related to Ghostty,
but I wanted to make sure it got in before the 1.2.0 release since it
contains the removal of non-functional code that wasn't compiling, just
for correctness' sake.

Also if for some reason ARGB/XRGB is needed for some utility purpose,
it's there now. 🙂
2025-09-08 13:58:40 -07:00
Chris Marchesi
813e01a813 deps: update z2d to v0.8.0
Release notes at:
  https://github.com/vancluever/z2d/blob/v0.8.0/CHANGELOG.md

This is a small update and likely contains nothing related to Ghostty,
but I wanted to make sure it got in before the 1.2.0 release since it
contains the removal of non-functional code that wasn't compiling, just
for correctness' sake.

Also if for some reason ARGB/XRGB is needed for some utility purpose,
it's there now. :)
2025-09-08 11:15:01 -07:00
Qwerasd
31e54ff44a comment + style changes 2025-09-08 10:40:56 -06:00
Mitchell Hashimoto
1feb398641 build(deps): bump namespacelabs/nscloud-cache-action from 1.2.16 to 1.2.17 (#8562)
Bumps
[namespacelabs/nscloud-cache-action](https://github.com/namespacelabs/nscloud-cache-action)
from 1.2.16 to 1.2.17.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/namespacelabs/nscloud-cache-action/releases">namespacelabs/nscloud-cache-action's
releases</a>.</em></p>
<blockquote>
<h2>v1.2.17</h2>
<h2>What's Changed</h2>
<ul>
<li>Delete existing files at path before creating bind mount, this was
already handled correctly for existing directories but not for
files</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/namespacelabs/nscloud-cache-action/compare/v1.2.16...v1.2.17">https://github.com/namespacelabs/nscloud-cache-action/compare/v1.2.16...v1.2.17</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a289cf5d2f"><code>a289cf5</code></a>
Merge pull request <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/33">#33</a>
from namespacelabs/delete-existing-files-at-path-befor...</li>
<li><a
href="3851f57081"><code>3851f57</code></a>
Delete existing files at path before creating bind mount</li>
<li><a
href="58efedf646"><code>58efedf</code></a>
Merge pull request <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/32">#32</a>
from namespacelabs/delete-existing-files-at-path-befor...</li>
<li><a
href="5e60691b8f"><code>5e60691</code></a>
Delete existing files at path before creating bind mount</li>
<li>See full diff in <a
href="https://github.com/namespacelabs/nscloud-cache-action/compare/v1.2.16...a289cf5d2fcd6874376aa92f0ef7f99dc923592a">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=namespacelabs/nscloud-cache-action&package-manager=github_actions&previous-version=1.2.16&new-version=1.2.17)](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 merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@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>
2025-09-08 07:07:58 -07:00