11147 Commits

Author SHA1 Message Date
Qwerasd
1de35bbcb9 Fix viewport going out of bounds when zooming out (#7899)
The viewport pin was allowed to go below the active pin during resize,
which caused a use of null when trying to get the bottom right of the
viewport since going down by the active row count from the viewport pin
ends up below the bottom of the active area.

Ran in to this while doing font work because I was scrolled up slightly
and increasing and decreasing to see stuff at different sizes.
2025-07-09 23:15:26 -06:00
Qwerasd
ea4a056d34 test(terminal/PageList): resize keeps viewport <= active
This tests for the bug fixed in the last commit.
2025-07-09 22:47:01 -06:00
Mitchell Hashimoto
68418ecd53 Modernize our benchmarks (#7891)
This PR modernizes our benchmarks. This PR focuses on the benchmark
_framework_ and not the benchmarks themselves. That will come in later
PRs.

We now produce two binaries with `-Demit-bench`: `ghostty-bench` and
`ghostty-gen`. The former is our benchmark tool. The latter is our
synthetic data generation tool. The benchmarking CLI usually takes in
data from the synthetic generator but we want to do that offline because
synthetic data generation can be slow and CPU intensive and mess up our
benchmarks.

Our previous benchmark-specific binaries (like
`ghostty-bench-codepoint-width`) are all gone. This is all executed as
subcommands in the format similar to Ghostty users: `ghostty-bench
+codepoint-width --other --args`.

Previously, synthetic data generation was a mess and all unified with
`ghostty-bench-stream` which is just nasty. A dedicated CLI now gets us
args like `ghostty-gen +osc --p-valid=0.5`. Neat!

## Signposts and Xcode/Instruments on macOS

The benchmark framework now automatically emits
[signposts](https://developer.apple.com/documentation/os/recording-performance-data)
around the code that is under test. This is surfaced in Instruments as a
region that you can visualize and zoom in on so you can omit any of the
other overhead.

Additionally, I've integrated benchmarks with libghostty and our Xcode
project so you can just right click a benchmark to open it in
Instruments.

These are macOS-specific niceties but the core benchmarking tool is
platform-agnostic.

## Generalized CLI Actions

The `src/cli/action.zig` file was generalized so that it can be shared
amongst our three action-ized binaries. The Ghostty-specific actions are
now in `src/cli/ghostty.zig`. As an added bonus, our action parsing is
now fully unit tested.

I don't like mixing refactors in with other tasks in PRs but in this
case this one was done to enable not one but two other consumers in the
same PR, so I think it fits.

## TODO

Some things I want to do before merge.

- [ ] Add flags to `ghostty-bench` to configure once mode vs duration
mode
2025-07-09 21:42:53 -07:00
Mitchell Hashimoto
1317a55a9d build: make the xcframework step dsym aware, even though we don't use it (#7898)
This was in pursuit of trying to get line numbers in `zig build run` on
macOS to work, but I wasn't able to figure that out and this wasn't the
right path because static libs can't have dsyms. But, it may still be
useful to make the xcframework step dsym aware for future use so I'm
PRing this.

This also updates our libghostty build steps to use the new
`root_module` form which is recommend for Zig 0.14 and we forgot to
update long ago.
2025-07-09 21:41:10 -07:00
Mitchell Hashimoto
cc0d7acaef build: make the xcframework step dsym aware, even though we don't use it
This was in pursuit of trying to get line numbers in `zig build run` on
macOS to work, but I wasn't able to figure that out and this wasn't the
right path because static libs can't have dsyms. But, it may still be
useful to make the xcframework step dsym aware for future use so I'm
PRing this.
2025-07-09 21:35:02 -07:00
Qwerasd
6744e57c68 fix(terminal/PageList): update viewport in row count resize
Before, if the row count increase past the active area then we added new
rows to make sure that we had enough for the active area, but we didn't
make sure that the viewport pin wasn't below the active area pin, which
meant that later on if someone tried to get the bottom right pin for the
viewport it would overshoot and we'd use null. This resulted in either a
memory corruption bug in ReleaseFast if you scaled down the font while
scrolled up slightly, or in Debug mode it was just a crash.
2025-07-09 22:28:08 -06:00
Mitchell Hashimoto
d0c5191aef build(deps): bump cachix/install-nix-action from 31.4.1 to 31.5.0 (#7892)
Bumps
[cachix/install-nix-action](https://github.com/cachix/install-nix-action)
from 31.4.1 to 31.5.0.
<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.5.0</h2>
<h2>What's Changed</h2>
<ul>
<li>nix: 2.29.1 -&gt; 2.30.0 by <a
href="https://github.com/github-actions"><code>@​github-actions</code></a>
in <a
href="https://redirect.github.com/cachix/install-nix-action/pull/244">cachix/install-nix-action#244</a>
Release notes: <a
href="https://nix.dev/manual/nix/2.30/release-notes/rl-2.30.html">https://nix.dev/manual/nix/2.30/release-notes/rl-2.30.html</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/cachix/install-nix-action/compare/v31.4.1...v31.5.0">https://github.com/cachix/install-nix-action/compare/v31.4.1...v31.5.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="cebd211ec2"><code>cebd211</code></a>
Merge pull request <a
href="https://redirect.github.com/cachix/install-nix-action/issues/244">#244</a>
from cachix/create-pull-request/patch</li>
<li><a
href="358e2ef1b2"><code>358e2ef</code></a>
nix: 2.29.1 -&gt; 2.30.0</li>
<li>See full diff in <a
href="f0fe604f8a...cebd211ec2">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.4.1&new-version=31.5.0)](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-07-09 18:23:05 -07:00
dependabot[bot]
e962e9b517 build(deps): bump cachix/install-nix-action from 31.4.1 to 31.5.0
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 31.4.1 to 31.5.0.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Changelog](https://github.com/cachix/install-nix-action/blob/master/RELEASE.md)
- [Commits](f0fe604f8a...cebd211ec2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-10 00:22:27 +00:00
Mitchell Hashimoto
74b94ef30a remove src/bench 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
a09452bf1b synthetic: add osc/utf8 generators 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
a28b7e9205 synthetic cli (ghostty-gen) 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
b5ff0442d4 bench: remove old benchmarks we converted 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
99ed984af2 benchmark: add GraphemeBreak and TerminalParser benchmarks 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
5890826356 benchmark: add codepoint width benchmark 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
c990d35d6d macos: add benchmark tests to our Xcode project 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
20bb71c627 libghostty: export benchmark CLI API 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
01b2545d1d macos: fix signpost API to use proper mach header base addr 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
d30771ecff pkg/macos: use new @ptrcast for os.log 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
b8f5cf9d52 initial ghostty-bench program 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
1739418f6f cli: make the action parser (+foo) generic and reusable 2025-07-09 15:06:24 -07:00
Mitchell Hashimoto
0e8ccc7352 benchmark: a new package and framework for benchmarking 2025-07-09 15:06:23 -07:00
Mitchell Hashimoto
8506637ae6 macos: add signpost API 2025-07-09 15:06:23 -07:00
Jon Parise
464dc78172 shell-integration: use $GHOSTTY_BIN_DIR/ghostty (#7887) 2025-07-09 17:46:22 -04:00
Jon Parise
f5f2a4dd20 shell-integration: use $GHOSTTY_BIN_DIR/ghostty
Locate our ghostty binary using $GHOSTTY_BIN_DIR rather than searching
the PATH.
2025-07-09 17:25:34 -04:00
Jon Parise
87579b8594 shell-integration: simplify "ssh target" checks (#7884) 2025-07-09 16:32:11 -04:00
Jon Parise
e522d54d7b shell-integration: simplify "ssh target" checks
This value is always set to a non-empty string, and we only need this
value after we've determined that 'ssh_hostname' is non-empty.

In bash and zsh, we also don't need to check for the 'ghostty' command
before we attempt to add the target to the cache. That command will
safely fail silently if it's not available.
2025-07-09 15:59:59 -04:00
Mitchell Hashimoto
9ba9e29843 fish: prefer 'command -q' to check for commands (#7880)
This is a fish built-in 'command' option that's the more idiomatic way
to check for the availability of a command.

https://fishshell.com/docs/current/cmds/command.html
2025-07-09 11:59:39 -07:00
Jon Parise
a1cb52dcd3 fish: prefer 'command -q' to check for commands
This is a fish built-in 'command' option that's the more idiomatic way
to check for the availability of a command.

https://fishshell.com/docs/current/cmds/command.html
2025-07-09 14:34:00 -04:00
Jeffrey C. Ollie
5dbef8b47a linux: switch systemd user service to type notify-reload (#7791)
This enables `systemd` to send SIGUSR2 to Ghostty to signal it to reload
the configuration. This is much easier and reliable than using a script
to search process listings for Ghostty's main PID to send the signal to.
The command to do so is:

`systemctl reload --user com.mitchellh.ghostty.service`
2025-07-09 13:30:26 -05:00
Jeffrey C. Ollie
248acbea5b gtk: remove NOTIFY_SOCKET from the inherited environment variables 2025-07-09 13:11:02 -05:00
Jeffrey C. Ollie
c9d0bbefc2 linux: switch systemd user service to type=notify-reload
This allows `systemctl` to send SIGUSR2 to Ghostty to trigger a reload,
which is more convenient than scripting `ps` and `kill` to find the
Ghostty main PID.
2025-07-09 13:11:01 -05:00
Jeffrey C. Ollie
e18f16d94d linux: add functions for notifying systemd about process state
Functions for notifying systemd that we are ready or have started
reloading the configuration.
2025-07-09 13:11:01 -05:00
Mitchell Hashimoto
5ef51b8213 Run GTK unit tests in CI, fix broken tests (#7878) 2025-07-09 11:03:40 -07:00
Mitchell Hashimoto
86dbfb98d7 Run GTK unit tests in CI, fix broken tests
We only ran `apprt=none` tests in CI, which misses a huge surface area
of unit tests. Thankfully only a couple were broken. This fixes that.
2025-07-09 10:56:30 -07:00
Mitchell Hashimoto
d8e7a6634e build: temporarily disable stderr capture on distcheck 2025-07-09 10:22:50 -07:00
Qwerasd
ffc6fe8686 Improve CoreText "Quantization" (#7876)
The old math didn't allow fractional pixels on the left and bottom, and
stretched glyphs vertically since the height was always rounded up. At
very small font sizes this looked good, but at medium and even large
sizes this just made things inconsistent and janky.

These new calculations are practically pixel-identical to whatever
CoreText is doing in 99% of cases, and the remaining cases seem to be
some sort of auto-hinting since it's internal features of the glyph
getting repositioned.

Over all, I still prefer this to CoreText's quantize option, but if this
causes further issues we should probably just revert the whole thing and
go ahead and add an extra pixel of padding to the bottom and left...
2025-07-09 10:52:57 -06:00
Qwerasd
579b15bef7 font/coretext: rework glyph quantization math
The old math didn't allow fractional pixels on the left and bottom, and
stretched glyphs vertically since the height was always rounded up. At
very small font sizes this looked good, but at medium and even large
sizes this just made things inconsistent and janky.

These new calculations are practically pixel-identical to whatever
CoreText is doing in 99% of cases, and the remaining cases seem to be
some sort of auto-hinting since it's internal features of the glyph
getting repositioned.

Over all, I still prefer this to CoreText's quantize option, but if this
causes further issues we should probably just revert the whole thing and
go ahead and add an extra pixel of padding to the bottom and left...
2025-07-09 10:33:28 -06:00
Mitchell Hashimoto
e68c1d2cad config: add available since for SSH shell integration 2025-07-09 09:30:22 -07:00
Mitchell Hashimoto
5a5c9e4387 Add SSH Integration Configuration Option (#7608)
Addresses #4156 and #5892, specifically by implementing @mitchellh's
[request](https://github.com/ghostty-org/ghostty/discussions/5892#discussioncomment-12283628)
for "opt-in shell integration".

## Problem

Ghostty's custom `xterm-ghostty` TERM value breaks terminal
functionality when SSHing to remote systems that lack the corresponding
terminfo entry. This affects enterprise environments, legacy servers,
and ephemeral instances.

## Solution

Adds two independent SSH integration flags within the existing
`shell-integration-features` configuration:

```
shell-integration-features = ssh-env,ssh-terminfo
```

- **`ssh-env`**: TERM compatibility fix (xterm-ghostty → xterm-256color)
+ environment variable propagation (COLORTERM, TERM_PROGRAM,
TERM_PROGRAM_VERSION)
- **`ssh-terminfo`**: Automatic terminfo installation on remote hosts
with caching and utility commands

Flags work independently and harmoniously when combined, allowing users
granular control over SSH integration behavior.

## Implementation

Adds SSH wrapper functions across bash, zsh, fish, and elvish that
handle TERM compatibility, environment propagation, and terminfo
installation. Follows the same pattern as existing shell integration
features - client-side only with graceful fallback behavior.

The flag-based approach allows users to choose exactly the features they
need:
- Environment compatibility only: `ssh-env`
- Terminfo installation only: `ssh-terminfo` 
- Optimal experience: `ssh-env,ssh-terminfo`
- No SSH integration: omit both flags

## Evolution Note

Based on maintainer feedback, this evolved from a progressive
enhancement approach (`ssh-integration = basic | full`) to independent
flags within `shell-integration-features`. See discussion below for the
complete architectural evolution and rationale.
2025-07-09 09:28:40 -07:00
Qwerasd
b915084c38 font/coretext: don't use vertical overlap constraints 2025-07-09 10:28:35 -06:00
Mitchell Hashimoto
8ab3010bb8 cli: rewrite ssh-cache diskcache and test IO 2025-07-09 09:20:14 -07:00
Mitchell Hashimoto
7cfb026e84 cli: ssh-cache stylistic changes 2025-07-09 06:47:17 -07:00
Mitchell Hashimoto
bcb4e624a4 cli: fix macOS builds 2025-07-09 06:45:29 -07:00
Mitchell Hashimoto
2f4af5eb87 Changed behaviour of bold-color (#7871)
Continuation of discussion in
https://github.com/ghostty-org/ghostty/discussions/3134

This changes the behaviour of the new bold-color option to only affect
the default foreground text when set to a static colour. By using a
static colour, the remaining colours are rendered as bright.
2025-07-09 06:37:21 -07:00
Mitchell Hashimoto
7af3f28e5e core: document which release added config entries (#7859)
For each config entry, add a comment specifying in which release it was
first added. In some cases I note when certain aspects of each config
entry were modified.
2025-07-09 06:34:37 -07:00
Robert Ian Hawdon
94cca0cc17 Updated comment 2025-07-09 11:35:44 +01:00
Robert Ian Hawdon
57fdfe76bb Changed behaviour of bold-color 2025-07-09 11:33:12 +01:00
Leah Amelia Chen
b90deebfb2 build: disable fuzzy matching for msgmerge (#7866) 2025-07-09 15:15:21 +08:00
Jeffrey C. Ollie
13805f7cc5 build: disable fuzzy matching for msgmerge
CI is currently configured to fail if there are any fuzzy matches in
translation files. This change prevents `msgmerge` from creating any
fuzzy matches when translations are updated.
2025-07-08 22:17:20 -05:00
Jeffrey C. Ollie
527dcea266 core: avalability of config entry since 1.0.0 can be assumed 2025-07-08 22:06:27 -05:00