Commit Graph

13276 Commits

Author SHA1 Message Date
Mitchell Hashimoto
1a2b3c165a terminal/tmux: layoutChanged handling 2025-12-09 17:09:57 -08:00
Mitchell Hashimoto
071070faa3 terminal/tmux: handle session_changed inside command loop 2025-12-09 14:21:07 -08:00
Mitchell Hashimoto
64ef640127 terminal/tmux: exhaustive switch for command 2025-12-09 13:56:16 -08:00
Mitchell Hashimoto
938e419e04 terminal/tmux: handle output events 2025-12-09 13:13:52 -08:00
Mitchell Hashimoto
50ac848672 terminal/tmux: capture both primary/alt screen 2025-12-09 13:00:40 -08:00
Mitchell Hashimoto
a3e01581be terminal/tmux: history capture clears active area 2025-12-09 11:33:06 -08:00
Mitchell Hashimoto
b7fe9a926d terminal/tmux: capture visible area after history 2025-12-09 11:22:14 -08:00
Mitchell Hashimoto
41bf541005 terminal/tmux: test helper 2025-12-09 10:53:52 -08:00
Mitchell Hashimoto
e1e2791fb7 terminal/tmux: pane_history replays it into terminal 2025-12-09 10:00:43 -08:00
Mitchell Hashimoto
f02a2d5eed terminal/tmux: capture pane 2025-12-09 09:25:55 -08:00
Mitchell Hashimoto
766c306e04 terminal/tmux: pane history 2025-12-08 20:15:20 -08:00
Mitchell Hashimoto
ea09d257a1 terminal/tmux: initialize panes 2025-12-08 11:54:48 -08:00
Mitchell Hashimoto
86cd489701 terminal/tmux: introduce command queue for viewer 2025-12-08 09:00:38 -08:00
Mitchell Hashimoto
ec5a60a119 terminal/tmux: make sure we always have space for one action 2025-12-08 07:27:37 -08:00
Mitchell Hashimoto
b26c42f4a6 terminal/tmux: better formatting for notifications and actions 2025-12-08 07:00:44 -08:00
Mitchell Hashimoto
52dbca3d26 termio: hook up tmux viewer 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
3cbc232e31 terminal/tmux: return allocated list of actions 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
c1d686534e terminal/tmux: list windows 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
4c3ef8fa13 terminal/tmux: viewer list windows state 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
0d75a78747 terminal/tmux: start viewer state machine 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
af3a11b546 terminal/tmux: output has format/comptimeFormat 2025-12-08 07:00:43 -08:00
Mitchell Hashimoto
049b8826f6 macos: make QuickTerminalSize config C ABI compatible (#9837)
Hello! I did read `CONTRIBUTING.md`. I understand that the preference is
to receive pull requests for existing open issues and acknowledge that
I'm skipping a step wrt the preferred workflow since there aren't any
open issues yet for #8419. Living dangerously and hoping for the best
here. I hope you'll see that I'm acting in good faith 🤞.

In my attempts to debug why `quick-terminal-size` config wasn't working
reliably for me, I discovered that the
[`ghostty_config_quick_terminal_size_s`](08c9661683/include/ghostty.h (L460-L480))
struct used to initialize `QuickTerminalSize` in Swift-land, more often
than not, didn't match what I had in my config file (e.g.
`quick-terminal-size = 75%, 50%`)

<details>


08c9661683/include/ghostty.h (L460-L480)


08c9661683/macos/Sources/Ghostty/Ghostty.Config.swift (L507-L510)

</details>

Almost all mismatches seemed to be downstream of `tag` (for `primary`
and/or `secondary` `Size`) being an unexpected value for the
`ghostty_quick_terminal_size_tag_e` enum type, which led runtime
execution to fall into the `default` branch in this `switch` control
flow.


08c9661683/macos/Sources/Features/QuickTerminal/QuickTerminalSize.swift (L27-L38)

Looking at `src/config/CApi.zig`, `src/config/c_get.zig`,
`src/config/Config.zig`, and [Zig documentation for `extern
enum`](https://ziglang.org/documentation/master/#extern-enum), led me to
conclude that the crux of the issue is lack of guaranteed C ABI
compatibility for `Tag`


08c9661683/src/config/Config.zig (L7986-L7990)


08c9661683/include/ghostty.h (L461-L465)

Further research revealed that based on C language spec alone, one
cannot assume a fixed width for `enum` and that the behaviour is
compiler dependant. But given how the Zig documentation suggests using
`enum(c_int)` for C-ABI-compatible enums and extern enums + comments
elsewhere in `Config.zig` suggesting that `enum(c_int)` was chosen for
extern compatibility,


08c9661683/src/config/Config.zig (L4877)

I think that this fix (changing `enum(u8)` to `enum(c_int)`) is likely
the most straightforward and appropriate one.
2025-12-08 07:00:16 -08:00
Mitchell Hashimoto
cad96134fc build(deps): bump peter-evans/create-pull-request from 7.0.9 to 7.0.11 (#9839)
Bumps
[peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request)
from 7.0.9 to 7.0.11.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/peter-evans/create-pull-request/releases">peter-evans/create-pull-request's
releases</a>.</em></p>
<blockquote>
<h2>Create Pull Request v7.0.11</h2>
<h2>What's Changed</h2>
<ul>
<li>fix: restrict remote prune to self-hosted runners by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4250">peter-evans/create-pull-request#4250</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v7.0.10...v7.0.11">https://github.com/peter-evans/create-pull-request/compare/v7.0.10...v7.0.11</a></p>
<h2>Create Pull Request v7.0.10</h2>
<p>⚙️ Fixes an issue where updating a pull request failed when targeting
a forked repository with the same owner as its parent.</p>
<h2>What's Changed</h2>
<ul>
<li>build(deps): bump the github-actions group with 2 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4235">peter-evans/create-pull-request#4235</a></li>
<li>build(deps-dev): bump prettier from 3.6.2 to 3.7.3 in the npm group
by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4240">peter-evans/create-pull-request#4240</a></li>
<li>fix: provider list pulls fallback for multi fork same owner by <a
href="https://github.com/peter-evans"><code>@​peter-evans</code></a> in
<a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4245">peter-evans/create-pull-request#4245</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/obnyis"><code>@​obnyis</code></a> made
their first contribution in <a
href="https://redirect.github.com/peter-evans/create-pull-request/pull/4064">peter-evans/create-pull-request#4064</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/peter-evans/create-pull-request/compare/v7.0.9...v7.0.10">https://github.com/peter-evans/create-pull-request/compare/v7.0.9...v7.0.10</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="22a9089034"><code>22a9089</code></a>
fix: restrict remote prune to self-hosted runners (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4250">#4250</a>)</li>
<li><a
href="d4f3be6ce6"><code>d4f3be6</code></a>
fix: provider list pulls fallback for multi fork same owner (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4245">#4245</a>)</li>
<li><a
href="bc8a47f565"><code>bc8a47f</code></a>
build(deps-dev): bump prettier from 3.6.2 to 3.7.3 in the npm group (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4240">#4240</a>)</li>
<li><a
href="a67ef28ca5"><code>a67ef28</code></a>
build(deps): bump the github-actions group with 2 updates (<a
href="https://redirect.github.com/peter-evans/create-pull-request/issues/4235">#4235</a>)</li>
<li>See full diff in <a
href="84ae59a2cd...22a9089034">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=peter-evans/create-pull-request&package-manager=github_actions&previous-version=7.0.9&new-version=7.0.11)](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-12-08 06:55:48 -08:00
Mitchell Hashimoto
bb49537a05 CONTRIBUTING: various improvements and clarifications (#9835)
Despite the existence of #6937 it seems that there are still quite a few
people who aren't sure of the norms surrounding how to use Ghostty's
discussion spaces, so I chose to spell it all out here.

Regarding AI policy I also added a section heavily discouraging AI
responses within PRs and contributing to platforms one can't test on. I
don't understand what is wrong with vibecoders on macOS who just think
that the GTK side will somehow Just Work, despite us being pretty much
the only major piece of software using zig-gobject that I know of.
2025-12-08 06:53:42 -08:00
Mitchell Hashimoto
6c33bf1f5e Update iTerm2 colorschemes (#9832)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20251201-150531-bfb3ee1
2025-12-08 06:52:49 -08:00
Mitchell Hashimoto
9cd96e4b64 quirks: remove type signature for inlineAssert (#9843)
Functions with different calling conventions are not compatible with
each other

Fixes all release builds + CI
2025-12-07 21:57:48 -08:00
Leah Amelia Chen
2ac9e03c52 quirks: remove type signature for inlineAssert
Functions with different calling conventions are not compatible with
each other

Fixes all release builds + CI
2025-12-08 13:19:16 +08:00
Mitchell Hashimoto
0bbd7c8f9a os: fix off-by-one error in ShellEscapeWriter (#9842)
I am truly not sure why the tests never caught this, but I just fell for
the oldest trick in the book

Fixes a crash on GTK when a file is dragged then dropped into the
terminal - should not impact 1.2 as this is a casualty of the Zig 0.15
port
2025-12-07 21:17:12 -08:00
Leah Amelia Chen
6da2f0e3e7 os/shell: actually run tests 2025-12-08 13:04:20 +08:00
Leah Amelia Chen
ed1d77d518 os: fix off-by-one error in ShellEscapeWriter
I am truly not sure why the tests never caught this, but I just fell for
the oldest trick in the book
2025-12-08 12:42:35 +08:00
dependabot[bot]
5131998eda build(deps): bump peter-evans/create-pull-request from 7.0.9 to 7.0.11
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 7.0.9 to 7.0.11.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](84ae59a2cd...22a9089034)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 7.0.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-08 00:06:17 +00:00
Mitchell Hashimoto
ddca4a8412 make our quirks assert use std.debug.assert in debug builds (#9838)
This fixes an issue I have on both macOS and Linux (ARM and x86_64)
where stack traces are broken for inlined functions. They don't point to
the proper location in the source code, making debugging difficult.

Release builds use the same previous function.

cc @qwerasd205
2025-12-07 14:17:30 -08:00
Mitchell Hashimoto
9d4f96381a make our quirks assert use std.debug.assert in debug builds
This fixes an issue I have on both macOS and Linux (ARM and x86_64)
where stack traces are broken for inlined functions. They don't point to
the proper location in the source code, making debugging difficult.

Release builds use the same previous function.
2025-12-07 14:15:06 -08:00
Leah Amelia Chen
c9655eefe5 CONTRIBUTING: clarify discussion categories & discord channels 2025-12-07 13:08:42 +08:00
Leah Amelia Chen
90ab794457 CONTRIBUTING: tighten AI assistance disclosure requirements 2025-12-07 13:00:06 +08:00
voideanvalue
aa504b2784 add assertionFailure for unexpected QuickTerminalSize tag 2025-12-07 00:51:37 +00:00
mitchellh
6e081b2c81 deps: Update iTerm2 color schemes 2025-12-07 00:15:51 +00:00
voideanvalue
aa0afa2d02 fix C ABI compat for ghostty_quick_terminal_size_tag_e 2025-12-06 22:17:33 +00:00
Mitchell Hashimoto
08c9661683 ci: cancel prior test runs for the same git ref (#9819)
This should save on CI quite a bit. This will cancel our GHA runs when
you push to the same ref, except for `main`, where I want to make sure
every commit is tested.
2025-12-05 08:44:10 -08:00
Mitchell Hashimoto
d09621fa11 ci: cancel prior test runs for the same git ref
This should save on CI quite a bit. This will cancel our GHA runs when
you push to the same ref, except for `main`, where I want to make sure
every commit is tested.
2025-12-05 08:43:26 -08:00
Mitchell Hashimoto
e5def6f210 core: selection and copy bindings need to hold the big lock (#9818)
This was found by LLM hunting! We were not holding the lock properly
during these operations. There aren't any known cases where we can
directly attribute these races to issues but we did find at least one
consistent crash for a user when `linkAtPos` wasn't properly locked (in
another PR).

This continues those fixes.

https://ampcode.com/threads/T-6fc49f25-7f2f-4039-adb4-f86aaeced6d5
2025-12-05 08:36:47 -08:00
Mitchell Hashimoto
f98b12579e core: selection and copy bindings need to hold the big lock
This was found by LLM hunting! We were not holding the lock properly
during these operations. There aren't any known cases where we can
directly attribute these races to issues but we did find at least one
consistent crash for a user when `linkAtPos` wasn't properly locked (in
another PR).

This continues those fixes.
2025-12-05 08:33:11 -08:00
Mitchell Hashimoto
1207240cf1 core: hold lock during keyCallback when mouseRefreshLinks is called (#9813)
From #9812

I'm not sure if this is the root cause of the crash in #9812 but the
LLM-discovered issue that we are not holding a lock here appears to be a
real issue. I manually traced the code paths and thought about this and
looked where we call `mouseRefreshLinks` in other places and this
appears to be a real bug.
2025-12-04 19:49:35 -08:00
Mitchell Hashimoto
6b2097e872 core: hold lock during keyCallback when mouseRefreshLinks is called
From #9812

I'm not sure if this is the root cause of the crash in #9812 but the
LLM-discovered issue that we are not holding a lock here appears to be a
real issue. I manually traced the code paths and thought about this and
looked where we call `mouseRefreshLinks` in other places and this
appears to be a real bug.
2025-12-04 19:45:03 -08:00
Mitchell Hashimoto
3f241502c2 terminal/tmux: a lot more control mode parsing, functionality (#9803)
Continuing just build foundation for #1935. There are no user-facing
changes here.

- This adds more command parsing for control mode output. I _believe_ we
now parse enough to at least render everything initially for most tmux
sessions. At least, from the VT parsing side (we haven't done any GUI
work whatsoever to react to this).

- This also adds a new layout string parser, e.g.
`159x48,0,0{79x48,0,0,79x48,80,0}` into a useful struct. We'll need this
to convert our visible layouts into actual GUI components, eventually.

- This adds a new output format parser for commands such as
`list-windows`. Control mode sends output framed in `%begin/%end`
blocks, but the output is in an arbitrary format depending on the input
command and unrelated to control mode itself. The output format parser
will let us parse this output.

I think this is a good place to stop and PR. I think next up I might try
hooking up a state machine to `src/termio/stream_handler.zig` to start
actually working with this. Before that, it may behoove me to change
`stream_readonly` to support non-readonly operations via callback so I
can do DCS and maybe unit test this whole thing too.... we'll see where
the wind blows.

**AI disclosure:** AI wrote many tests and did a lot of implementation
here. I reviewed everything manually though and understand it all
completely.
2025-12-04 15:30:13 -08:00
Mitchell Hashimoto
cf23d1c39d core: rate limit BEL character processing (#9810)
If the BEL character is received too frequently, the GUI thread can be
starved and Ghostty will lock up and eventually crash. This PR limits
BEL handling to 1 per 100ms.

Fixes #9800.
2025-12-04 15:29:58 -08:00
Jeffrey C. Ollie
68426dc21a core: rate limit BEL character processing
If the BEL character is received too frequently, the GUI thread can be
starved and Ghostty will lock up and eventually crash. This PR limits
BEL handling to 1 per 100ms.

Fixes #9800.
2025-12-04 12:32:58 -06:00
Mitchell Hashimoto
6b21b9147c terminal/tmux: add output format parsing (minimal) 2025-12-03 20:23:28 -08:00
Mitchell Hashimoto
b95965cb5a terminal/tmux: add layout-change to control mode parsing 2025-12-03 13:27:37 -08:00
Mitchell Hashimoto
92ea8d0eb5 terminal/tmux: layout checksums 2025-12-03 13:27:37 -08:00