Commit Graph

11991 Commits (93debc439ccc87e8dee82d73c49a693a368b0685)

Author SHA1 Message Date
ClearAspect f7994e6412 fix: correct the cursor Y position value exposed to shader uniforms
Fix for discussion #8113

The cursor Y position value exposed to the shader uniforms was
incorrectly calculated. As per the doc in cell_text.v.glsl: In order to
get the top left of the glyph, we compute an offset based on the
bearings. The Y bearing is the distance from the bottom of the cell to
the top of the glyph, so we subtract it from the cell height to get the
y offset.

This calculation was mistakenly left out of the original code.

This will ensure that the custom shaders using
iCurrentCursor/iPreviousCursor get the correct Y coordinate representing
the top-left corner of the cursor rectangle, matching the documented
uniform behavior
2025-08-21 10:08:49 -07:00
Mitchell Hashimoto f178f4419e
macos: fix iOS builds 2025-08-21 10:03:25 -07:00
Nicholas Mata f1c68f698b Correct Swift formatting inconsistencies 2025-08-21 10:00:15 -07:00
Nicholas Mata 5948bd3f02 Add support for 'custom' on 'macos_icon' to support a completely custom app icon 2025-08-21 10:00:15 -07:00
Nicholas Mata 29419e7aac Make macos icon persistent even when app is closed 2025-08-21 10:00:15 -07:00
Mitchell Hashimoto 66e5081721
ci: add timeout to snap and windows jobs (#8329)
There have been times these runaway taking forever for unknown reasons.
2025-08-21 09:29:44 -07:00
Mitchell Hashimoto e92fe9d9f8
ci: add timeout to snap and windows jobs
There have been times these runaway taking forever for unknown reasons.
2025-08-21 09:22:14 -07:00
Mitchell Hashimoto e3e69269e5
Switch macOS builds to Tahoe (Beta 7 currently) (#8328)
This switches our macOS builds to build on Tahoe, rather than on
Sequoia.

The primary motivation is to get builds out using a new Xcode version
(our builds at the time of writing this are _still produced_ with beta
1! ONE!). Every subsequent beta has had bugs that have prevented us from
upgrading, amusingly enough. But the later betas _also_ have a bunch of
fixes I want to get in. I hope this one works...

The reason we have to use Tahoe instead of Sequoia is because on
Sequoia, builds in CI _crash xcodebuild_. This is definitely an Apple
bug but I can't reproduce it locally to create a bug report, so I'm not
sure what to do.
2025-08-21 09:19:53 -07:00
Mitchell Hashimoto 82f7cd2133
ci: switch release builds to tahoe builders 2025-08-21 09:05:34 -07:00
Mitchell Hashimoto 7bb493e6ac
ci: switch to Tahoe for builds 2025-08-21 07:36:59 -07:00
Mitchell Hashimoto 073a8b01d2
terminal: explicitly initialize undefined fields at runtime (#8323)
This works around the Zig issue as noted in the comment.

No new Valgrind issues found from this.
2025-08-21 07:34:21 -07:00
Jeffrey C. Ollie 36f7e018ae
gtk-ng: more complete GTK startup/shutdown 2025-08-21 09:29:22 -05:00
Mitchell Hashimoto 531924e7e7
terminal: explicitly initialize undefined fields at runtime
This works around the Zig issue as noted in the comment.

No new Valgrind issues found from this.
2025-08-21 07:27:43 -07:00
Mitchell Hashimoto 2ffc61d21e
gtk-ng: properly skip Zig test (#8322) 2025-08-21 07:25:30 -07:00
Jeffrey C. Ollie 2d0f930e6a
gtk-ng: properly skip Zig test 2025-08-21 09:14:06 -05:00
Mitchell Hashimoto 7a42c82d18
temp: try downloading metal explicitly 2025-08-21 07:06:40 -07:00
Mitchell Hashimoto d66747407d
ci: move to bleedging edge sequoia builds
This will bring in Xcode 26 Beta 4 which I believe fixes all the known
issue we were dealing with keeping us on beta 1.
2025-08-21 07:06:40 -07:00
Mitchell Hashimoto 0e81f8d4e2
flatpak: manually install Zig 0.14.1 (#8311)
The SDK published on Flathub updated to Zig 0.15.1 which broke the
Flathub build in CI. So let's install it ourselves so that we can
control the version.
2025-08-21 07:04:50 -07:00
Mitchell Hashimoto 4cc33b546c
Full unit test suite passing Valgrind (#8319)
This contains the various changes necessary to get the full unit test
suite passing Valgrind, and configures CI to run this.

I disabled relatively few (less than 10) tests under Valgrind because
they're way too slow: all `verifyIntegrity` tests, because those run
anyways in debug and check their own memory health, a font test that
fills out font map, and the sprite render test. Everything else runs
as-is.

I found a number of issues, most were in the tests themselves. A couple
in actual code. A funny one was some undefined memory on tabstop resize
if you exceed the default number of tabstops. I don't know any real
world program that ever even did that (memory issue aside), and that
whole file hasn't been touched since 2022, so that was funny.

No memory leaks in actual code, but a number of leaks in tests. All
resolved.

I think we're still missing some reports because of the Zig bug:
https://github.com/ziglang/zig/issues/19148 so I'm gong to audit our
codebase after this and look for cases of that.
2025-08-21 07:04:13 -07:00
Mitchell Hashimoto 793e817d74
ci: run all valgrind tests 2025-08-21 06:58:08 -07:00
Mitchell Hashimoto 96a0b9021c
font: disable sprite test in valgrind 2025-08-21 06:57:25 -07:00
Mitchell Hashimoto fe5eafac0a
font: fix fontconfig leaks in unit tests 2025-08-21 06:53:59 -07:00
Jeffrey C. Ollie 6427a21679
flatpack: add back to list of required CI jobs 2025-08-21 00:42:18 -05:00
Qwerasd d2ac29c919
font/CoreText: fix positioning for padded scaled glyphs (#8310)
When constraints increased or decreased the size significantly, the
fractional position was getting messed up by the scale. This change
separates that out so that it applies correctly.

I noticed this when messing around with constraints, adding this
constraint to every glyph and then running with `font-family=Arial` and
`adjust-cell-width = -35%` (if you want to reproduce this)
```zig
constraint = .{
    .size_horizontal = .stretch,
    .align_horizontal = .center,
    .pad_left = 0.1,
    .pad_right = 0.1,
};
```
The padding was disproportionately affecting thin glyphs that were
stretched a lot. The problem was that the padding was being multiplied
by the scale.

This also made it so the top or right of said thin glyphs often got
clipped off by the edge of the canvas.

Anyway I fixed it.

|Before|After|
|-|-|
|<img width="1824" height="1480" alt="image"
src="https://github.com/user-attachments/assets/32779f9d-a048-4a8c-b5ea-0e8a851d5119"
/>|<img width="1824" height="1480" alt="image"
src="https://github.com/user-attachments/assets/5bf449e5-699e-4bdc-ac96-2b776f9fb7fa"
/>|
2025-08-20 21:55:51 -06:00
Mitchell Hashimoto a57afd41ac
terminal: fix undefined memory access in unit test 2025-08-20 20:54:29 -07:00
Mitchell Hashimoto 566062c0a5
terminal: fix undefined memory in Tabstops code 2025-08-20 20:44:35 -07:00
Mitchell Hashimoto be51f3e729
terminal: fix uninitialized memory in Cell init 2025-08-20 20:21:26 -07:00
Mitchell Hashimoto 3ce043123b
terminal: fix undefined memory access in PageList eraseRows 2025-08-20 19:53:33 -07:00
Mitchell Hashimoto 2cebc225c0
ci: failing pagelist tests
on purpose, so we can verify CI fails
2025-08-20 19:46:37 -07:00
Jeffrey C. Ollie 1f7f678745
flatpak: manually install Zig 0.14.1
The SDK published on Flathub updated to Zig 0.15.1 which broke the
Flathub build in CI. So let's install it ourselves so that we can
control the version.
2025-08-20 19:10:25 -05:00
Qwerasd 610ce94f2d font/CoreText: fix positioning for padded scaled glyphs
When constraints increased or decreased the size significantly, the
fractional position was getting messed up by the scale. This change
separates that out so that it applies correctly.
2025-08-20 15:26:16 -06:00
Mitchell Hashimoto 4fa7b412d4
terminal: disable integrity checks under Valgrind 2025-08-20 14:05:31 -07:00
Mitchell Hashimoto fec0defd04
ci: run valgrind in CI (#8309)
This runs Valgrind on our unit test suite in CI. Since we're not
currently passing Valgrind, this will be incrementally updated with the
filters for our passing tests. Ultimately, we'll remove the filters and
run the full suite.

Valgrind is slow and hungry so this is our first and only job currently
on a large instance.
2025-08-20 13:30:09 -07:00
Mitchell Hashimoto 5287b963c9
ci: run valgrind in CI
This runs Valgrind on our unit test suite in CI. Since we're not
currently passing Valgrind, this will be incrementally updated with the
filters for our passing tests. Ultimately, we'll remove the filters and
run the full suite.

Valgrind is slow and hungry so this is our first and only job currently
on a large instance.
2025-08-20 13:25:30 -07:00
Mitchell Hashimoto f1300ec44f
terminal: fix undefined memory access in OSC parser (#8307)
Fixes #8007

Verified with `test-valgrind -Dtest-filter="OSC"` which had cond access
errors before, and none after this. Basically a copy of #8008.
2025-08-20 13:15:40 -07:00
Mitchell Hashimoto 42f0c05d7e
terminal: fix undefined memory access in OSC parser
Fixes #8007

Verified with `test-valgrind -Dtest-filter="OSC"` which had cond access
errors before, and none after this. Basically a copy of #8008.
2025-08-20 13:05:57 -07:00
Jeffrey C. Ollie 108260100c
gtk-ng: add a helper to reduce boilerplate in GTK IPC 2025-08-20 14:53:17 -05:00
Mitchell Hashimoto 6aac8bfc24
terminal: change OSC parser to explicit init to set undefined (#8304)
This works around: https://github.com/ziglang/zig/issues/19148 This lets
our `test-valgrind` command catch some issues. We'll have to follow this
pattern in more places but I want to do it incrementally so things keep
passing.

I **do not** want to blindly follow this pattern everywhere. I want to
start by focusing in only on the structs that set `undefined` as default
fields that we're also about to test in isolation with Valgrind. It's
just too much noise otherwise and not a general style I'm sure of; it's
worth it for Valgrind though.

I'm making this PR separate from any fixes because the diff is so noisy
I don't want to lose the fixes in the noise. **This PR is therefore
functionally a no-op.**
2025-08-20 12:42:46 -07:00
Mitchell Hashimoto 131f170f89
terminal: change OSC parser to explicit init to set undefined
This works around: https://github.com/ziglang/zig/issues/19148
This lets our `test-valgrind` command catch some issues. We'll have to
follow this pattern in more places but I want to do it incrementally so
things keep passing.

I **do not** want to blindly follow this pattern everywhere. I want to
start by focusing in only on the structs that set `undefined` as default
fields that we're also about to test in isolation with Valgrind. Its
just too much noise otherwise and not a general style I'm sure of; it's
worth it for Valgrind though.
2025-08-20 12:38:29 -07:00
Mitchell Hashimoto b3a80f2e47
build: add run-valgrind and test-valgrind steps (#8302)
This adds two explicit `zig build` steps: `run-valgrind` and
`test-valgrind` to run the Ghostty exe or tests under Valgrind,
respectively.

This simplifies the manual Valgrind calls in a few ways:

1. It automatically sets the CPU to baseline, which is a frequent and
requirement for Valgrind on newer CPUs, and generally safe.

2. It sets up the rather complicated set of flags to call Valgrind with,
importantly setting up our suppressions.

3. It enables pairing it with the typical and comfortable workflow of
specifying extra args (with `--`) or flags like `-Dtest-filter` for
tests.
2025-08-20 12:27:35 -07:00
Mitchell Hashimoto f87213c2f6
build: add run-valgrind and test-valgrind steps
This adds two explicit `zig build` steps: `run-valgrind` and
`test-valgrind` to run the Ghostty exe or tests under Valgrind,
respectively.

This simplifies the manual Valgrind calls in a few ways:

1. It automatically sets the CPU to baseline, which is a frequent and
   requirement for Valgrind on newer CPUs, and generally safe.

2. It sets up the rather complicated set of flags to call Valgrind with,
   importantly setting up our suppressions.

3. It enables pairing it with the typical and comfortable workflow of
   specifying extra args (with `--`) or flags like `-Dtest-filter` for
   tests.
2025-08-20 11:43:48 -07:00
Jeffrey C. Ollie a909aac252
contributing: add some notes about running valgrind (#8298) 2025-08-20 11:41:55 -05:00
Jeffrey C. Ollie 4171cd64e0
wuffs: simplify the build (#8299) 2025-08-20 11:37:51 -05:00
Jeffrey C. Ollie 3cce5d26d7
wuffs: simplify the build 2025-08-20 10:08:24 -05:00
Jeffrey C. Ollie 6032732001
contributing: add some notes about running valgrind 2025-08-20 09:03:48 -05:00
Mitchell Hashimoto b52879b467
snap: remove workaround for build failures (#8292) 2025-08-19 20:35:35 -07:00
Jeffrey C. Ollie aa26f8fd34
snap: remove workaround for build failures 2025-08-19 21:49:05 -05:00
Mitchell Hashimoto e71c23802f
AI tooling must be disclosed for contributions (#8289)
I think, at this stage of AI, it is a common courtesy to disclose this. 

In a perfect world, AI assistance would produce equal or higher quality
work than any human. That isn't the world we live in today, and in many
cases it's generating slop. I say this despite being a fan of and using
them successfully myself (with heavy supervision)! I think the major
issue is **inexperienced human drivers of AI** that aren't able to
**adequately review their generated code.** As a result, they're pull
requesting code that I'm sure they would be ashamed of if they knew how
bad it was.

The disclosure is to help maintainers assess how much attention to give
a PR. While we aren't obligated to in any way, I try to assist
inexperienced contributors and coach them to the finish line, because
getting a PR accepted is an achievement to be proud of. But if it's just
an AI on the other side, I don't need to put in this effort, and it's
rude to trick me into doing so.

**I'm a fan of AI assistance and use AI tooling myself.** But, we need
to be responsible about what we're using it for and respectful to the
humans on the other side that may have to review or maintain this code.

(In the spirit of this PR... none of this PR was AI generated. lol.)
2025-08-19 15:52:24 -07:00
Mitchell Hashimoto 7022c79521
ci: workaround snap builder issues (#8290)
Workaround produced by Namespace support. Thanks!
2025-08-19 15:52:15 -07:00
Mitchell Hashimoto b4833c83cc
ci: workaround snap builder issues
Workaround produced by Namespace support. Thanks!
2025-08-19 15:29:06 -07:00