Commit Graph

16378 Commits

Author SHA1 Message Date
Mitchell Hashimoto
06aee71b72 build(deps): bump softprops/action-gh-release from 3.0.0 to 3.0.1 (#13059)
Bumps
[softprops/action-gh-release](https://github.com/softprops/action-gh-release)
from 3.0.0 to 3.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/releases">softprops/action-gh-release's
releases</a>.</em></p>
<blockquote>
<h2>v3.0.1</h2>
<h2>3.0.1</h2>
<ul>
<li>maintenance release with updated dependencies</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md">softprops/action-gh-release's
changelog</a>.</em></p>
<blockquote>
<h2>3.0.1</h2>
<ul>
<li>maintenance release with updated dependencies</li>
</ul>
<h2>3.0.0</h2>
<p><code>3.0.0</code> is a major release that moves the action runtime
from Node 20 to Node 24.
Use <code>v3</code> on GitHub-hosted runners and self-hosted fleets that
already support the
Node 24 Actions runtime. If you still need the last Node 20-compatible
line, stay on
<code>v2.6.2</code>.</p>
<h2>What's Changed</h2>
<h3>Other Changes 🔄</h3>
<ul>
<li>Move the action runtime and bundle target to Node 24</li>
<li>Update <code>@types/node</code> to the Node 24 line and allow future
Dependabot updates</li>
<li>Keep the floating major tag on <code>v3</code>; <code>v2</code>
remains pinned to the latest <code>2.x</code> release</li>
</ul>
<h2>2.6.2</h2>
<h2>What's Changed</h2>
<h3>Other Changes 🔄</h3>
<ul>
<li>chore(deps): bump picomatch from 4.0.3 to 4.0.4 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/775">softprops/action-gh-release#775</a></li>
<li>chore(deps): bump brace-expansion from 5.0.4 to 5.0.5 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/777">softprops/action-gh-release#777</a></li>
<li>chore(deps): bump vite from 8.0.0 to 8.0.5 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/781">softprops/action-gh-release#781</a></li>
</ul>
<h2>2.6.1</h2>
<p><code>2.6.1</code> is a patch release focused on restoring linked
discussion thread creation when
<code>discussion_category_name</code> is set. It fixes
<code>[#764](https://github.com/softprops/action-gh-release/issues/764)</code>,
where the draft-first publish flow
stopped carrying the discussion category through the final publish
step.</p>
<p>If you still hit an issue after upgrading, please open a report with
the bug template and include a minimal repro or sanitized workflow
snippet where possible.</p>
<h2>What's Changed</h2>
<h3>Bug fixes 🐛</h3>
<ul>
<li>fix: preserve discussion category on publish by <a
href="https://github.com/chenrui333"><code>@​chenrui333</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/765">softprops/action-gh-release#765</a></li>
</ul>
<h2>2.6.0</h2>
<p><code>2.6.0</code> is a minor release centered on
<code>previous_tag</code> support for
<code>generate_release_notes</code>,
which lets workflows pin GitHub's comparison base explicitly instead of
relying on the default range.
It also includes the recent concurrent asset upload recovery fix, a
<code>working_directory</code> docs sync,
a checked-bundle freshness guard for maintainers, and clearer
immutable-prerelease guidance where
GitHub platform behavior imposes constraints on how prerelease asset
uploads can be published.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="718ea10b13"><code>718ea10</code></a>
release 3.0.1</li>
<li><a
href="f1a938b9d8"><code>f1a938b</code></a>
chore(deps): bump esbuild from 0.28.0 to 0.28.1 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/802">#802</a>)</li>
<li><a
href="0066ead0de"><code>0066ead</code></a>
chore(deps): bump vite from 8.0.14 to 8.0.16 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/806">#806</a>)</li>
<li><a
href="dc643cac62"><code>dc643ca</code></a>
chore(deps): bump the npm group with 3 updates (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/805">#805</a>)</li>
<li><a
href="85ee99b6b2"><code>85ee99b</code></a>
chore(deps): bump actions/checkout in the github-actions group (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/804">#804</a>)</li>
<li><a
href="9ed3cf9a68"><code>9ed3cf9</code></a>
chore(deps): bump the npm group with 2 updates (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/800">#800</a>)</li>
<li><a
href="3efcac8951"><code>3efcac8</code></a>
chore(deps): bump the npm group with 3 updates (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/798">#798</a>)</li>
<li><a
href="05d6b9164a"><code>05d6b91</code></a>
chore(deps): bump brace-expansion from 5.0.5 to 5.0.6 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/797">#797</a>)</li>
<li><a
href="403a5240f3"><code>403a524</code></a>
chore(deps): bump <code>@​types/node</code> from 24.12.2 to 24.12.3 in
the npm group (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/796">#796</a>)</li>
<li><a
href="437e073e78"><code>437e073</code></a>
chore(deps): bump the npm group with 4 updates (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/792">#792</a>)</li>
<li>Additional commits viewable in <a
href="b430933298...718ea10b13">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=softprops/action-gh-release&package-manager=github_actions&previous-version=3.0.0&new-version=3.0.1)](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 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>
2026-06-22 13:06:44 -07:00
Mitchell Hashimoto
6f274295db macOS: fix tabs frame on macOS 27 beta 2 (#13069)
Also created a follow-up task to check whether this will survive the
final release: #13070
2026-06-22 13:06:29 -07:00
Lukas
632aa67560 macOS: fix tabs frame on macOS 27 beta 2 2026-06-22 21:59:14 +02:00
ghostty-vouch[bot]
45db2c2551 Update VOUCHED list (#13065)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13063#discussioncomment-17394374)
from @pluiedev.

Denounce: @schickling-assistant

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-22 15:00:56 +00:00
dependabot[bot]
1fcc622d63 build(deps): bump softprops/action-gh-release from 3.0.0 to 3.0.1
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](b430933298...718ea10b13)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-22 00:12:25 +00:00
kat
4749c4e937 i18n(kk): translate missing "Close Split" string (#13052) 2026-06-20 12:30:53 +00:00
AnmiTaliDev
e2e6153112 i18n(kk): translate missing "Close Split" string 2026-06-20 17:08:25 +05:00
Tristan Partin
5d0a82ba33 Remove unintended reasoning for user 'qappell' in vouched list (#13050)
It seems that when I ran `!vouch qappell`, the qappell was used as the
reasoning for the vouch. That was not my intention.
2026-06-19 10:11:38 -05:00
ghostty-vouch[bot]
49a9181560 Update VOUCHED list (#13043)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12645#discussioncomment-17343861)
from @tristan957.

Vouch: @qappell

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-19 00:00:56 +00:00
Mitchell Hashimoto
f9c52d0cd9 build: skip tip release when nothing release-relevant changed since last tip (#12989)
There's a [short
discussion](https://discord.com/channels/1005603569187160125/1005603569711452192/1504521818495651910)
about this in Discord, I don't any existing discussion or issues.

### AI Disclosure

Claude implemented this, changes are looking good to me, but I could be
wrong.
2026-06-18 13:34:25 -07:00
Mitchell Hashimoto
136ced5d51 macOS: disable liquid class explicitly for layers in icon (#12999)
Remove the tiny border in app icon on macOS 27. It seems like macOS 27
will [enable liquid
glass](https://developer.apple.com/documentation/xcode/creating-your-app-icon-using-icon-composer/#Apply-Liquid-Glass-effects-to-groups-and-layers)
for layers in icon that do not disable liquid glass explicitly.

<img width="2662" height="1061" alt="Xnip2026-06-12_09-52-19"
src="https://github.com/user-attachments/assets/a25f0157-64ef-46cd-8c27-f23eddd1df09"
/>

> Left is Icon Composer 1.5 in Xcode 26, right is Icon Composer 2.0 in
Xcode 27

I know macOS 27 is still in beta, and default behaviors are very likely
to change before public release. But I think this change is reasonable,
and it's the original intention.

Relates to #13001 

---

Before(Left) and After(Right)
<table>
    <tr>
      <td><img width="522" height="294" alt="Xnip2026-06-12_09-36-37"

src="https://github.com/user-attachments/assets/84682907-9ed7-4d93-9b18-2ffd3354e1ad"
/></td>
      <td><img width="542" height="274" alt="Xnip2026-06-12_09-39-31"

src="https://github.com/user-attachments/assets/5ae3af36-a081-4a8f-a204-10b48bc113ee"
/></td>
    </tr>
    <tr>
      <td><img width="572" height="290" alt="Xnip2026-06-12_09-39-46"

src="https://github.com/user-attachments/assets/a8622bf0-4973-403c-ac31-9fa087d7c012"
/></td>
      <td><img width="516" height="284" alt="Xnip2026-06-12_09-40-05"

src="https://github.com/user-attachments/assets/212ef852-54c2-47fe-9452-7214fbcb7511"
/></td>
    </tr>
  </table>
2026-06-18 13:34:02 -07:00
Mitchell Hashimoto
c04e2b64d9 macOS: get latest TerminalEntity's kind, title, pwd and screenshot (#13007)
This fixes these being wrong after creating a terminal window for the
first time.

Found them when trying [App Intent
Testing](https://developer.apple.com/documentation/AppIntentsTesting/testing-your-app-intents-code),
and confirmed them with macOS 26 as well (which is expected)

<img width="2560" height="546" alt="Xnip2026-06-13_20-48-50"
src="https://github.com/user-attachments/assets/7b13217d-66f5-48e2-ad69-9a489c22ad82"
/>

## AI Disclosure

Claude drafted the initial version, i manually refined and tested them
myself.
2026-06-18 13:33:34 -07:00
Mitchell Hashimoto
b12be54ac3 Update iTerm2 colorschemes (#13010)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20260608-160426-8c84dd1
2026-06-18 13:32:07 -07:00
ghostty-vouch[bot]
adce7b900a Update VOUCHED list (#13036)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13028#discussioncomment-17341591)
from @bo2themax.

Vouch: @exlee

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-17 17:24:34 +00:00
ghostty-vouch[bot]
e8e7fea103 Update VOUCHED list (#13033)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13031#discussioncomment-17329468)
from @jcollie.

Vouch: @kostich

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-16 21:20:54 +00:00
ghostty-vouch[bot]
e2689b0ebb Update VOUCHED list (#13032)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13030#issuecomment-4723744256)
from @jcollie.

Vouch: @kostich

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-16 21:20:31 +00:00
Lukas
124c9d57d0 macOS: overrode function syncAppearance in order to update the tab bar as well (#13017)
#12949 
I'm unsure about the performance implications of overriding
syncAppearance as opposed to other methods(ie setupKVO or
setupTabGroupObservation) but I found that this shows the tab group
correctly.
2026-06-16 14:39:51 +02:00
Sahil Mishra
8e8a8dc113 added async fix in order to resolve first second tab issue 2026-06-15 20:51:35 -04:00
Sahil Mishra
c3ceb55f5f added comment explaining fix 2026-06-15 10:12:44 -04:00
Sahil Mishra
749d45490a fix swiftlint 2026-06-15 10:04:54 -04:00
ghostty-vouch[bot]
fdbf9ff3a3 Update VOUCHED list (#13023)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/13017#issuecomment-4704742285)
from @bo2themax.

Vouch: @sahilkmishra

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-15 05:06:59 +00:00
ghostty-vouch[bot]
699387c2c1 Update VOUCHED list (#13018)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/13013#discussioncomment-17300150)
from @jcollie.

Vouch: @ajr-khll

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-14 20:03:37 +00:00
Sahil Mishra
4668a371c1 overrode function syncAppearance in order to update the tab bar as well 2026-06-14 15:30:08 -04:00
mitchellh
1182a76df6 deps: Update iTerm2 color schemes 2026-06-14 00:53:36 +00:00
Lukas
e2832ae1fe macOS: get latest TerminalEntity's kind, title & pwd
This fixes these being wrong after creating a terminal window for the first time.
2026-06-13 20:56:34 +02:00
Lukas
4a20972fc5 macOS: disable liquid class explictly 2026-06-12 09:50:04 +02:00
Claude Fable 5
7595203bed ci: skip tip release when nothing release-relevant changed since last tip 2026-06-11 14:43:34 +02:00
ghostty-vouch[bot]
5659cef41f Update VOUCHED list (#12978)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12977#discussioncomment-17251869)
from @jcollie.

Vouch: @jamesarch

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-10 14:14:24 +00:00
Mitchell Hashimoto
69095e298a terminal: support click_events=2 (#12953)
## Context 

Implements the OSC 133 `click_events=2` such that click events on the
terminal are sent to the shell where the y coordinate is sent relative
to the prompt pin.

See
https://sw.kovidgoyal.net/kitty/shell-integration/#click_events=1|2:~:text=click%5Fevents,xterm
further detailed explanation.

This should close https://github.com/ghostty-org/ghostty/issues/10865

### Testing

I did some basic manual testing here via the following: 
```
ghostty  main
❯ printf '\033]133;A;click_events=1\007' && cat
^[[<0;49;4M^[[<0;48;8M^[[<0;47;12M^C

ghostty  main  5s
❯ printf '\033]133;A;click_events=2\007' && cat
^[[<0;50;1M^[[<0;49;4M^[[<0;48;9M^[[<0;48;14M^C
```

#### Notes  	  

This is my first Ghostty PR. All code here is hand-rolled, AI was used
to do "smart" code searches/point me in the right direction.

I'm actively trying to learn Zig, Ghostty, and get more involved with
the community here so I'm avoiding obtuse usage of AI where possible.

Any feedback or tips are more than welcome! Thank you! 🙏
2026-06-08 06:31:21 -07:00
Alex Bennett
fd882c67cc pr review: added saturated arithmetic 2026-06-08 16:50:41 +08:00
ghostty-vouch[bot]
3ba5e9c243 Update VOUCHED list (#12958)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/12954#discussioncomment-17215965)
from @pluiedev.

Vouch: @alexbathome

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-08 06:13:22 +00:00
Mitchell Hashimoto
2ba5e6b929 lib-vt: add pwd_changed callback for OSC 7/9/1337 (#12956)
Previously the libghostty-vt stream handler dropped .report_pwd as a
no-op, so embedders never saw shell-reported cwd changes and the
terminal's pwd field was never populated from escape sequences.

Wire the action to setPwd and expose a pwd_changed callback analogous to
title_changed via GHOSTTY_TERMINAL_OPT_PWD_CHANGED. The payload is
passed through unparsed; embedders read it with ghostty_terminal_get and
decode any URI scheme themselves.

This is proposed in
[discussion#12927](https://github.com/ghostty-org/ghostty/discussions/12927)
2026-06-07 19:51:09 -07:00
Zongyuan Li
002fd41429 lib-vt: add pwd_changed callback for OSC 7/9/1337
Previously the libghostty-vt stream handler dropped .report_pwd as a
no-op, so embedders never saw shell-reported cwd changes and the
terminal's pwd field was never populated from escape sequences.

Wire the action to setPwd and expose a pwd_changed callback analogous
to title_changed via GHOSTTY_TERMINAL_OPT_PWD_CHANGED. The payload is
passed through unparsed; embedders read it with ghostty_terminal_get
and decode any URI scheme themselves.
2026-06-08 10:22:11 +08:00
Alex Bennett
97777cf5a3 fix: fix tests, change enum fields to lowercase 2026-06-07 23:55:47 +08:00
Alex Bennett
3263ce5122 terminal: support click_events=2 2026-06-07 23:01:53 +08:00
Mitchell Hashimoto
7092b39445 GTK: Improve Split Close Behavior (#11173)
## Summary
- Adds a "Close Split" option to the right-click context menu in the
split submenu
- Allows users to close the focused split pane directly from the context
menu

Reference discussion:
https://github.com/ghostty-org/ghostty/discussions/10982
2026-06-06 14:02:16 -07:00
Mitchell Hashimoto
f146db5535 terminal: hook up glyph protocol glossary to terminal state (#12937)
This hooks up the glyph protocol glossary to the terminal state. This
effectively makes us handle the APC protocol for it both in Ghostty GUI
and libghostty, although we didn't implement the renderer yet.

The Zig/C libghostty API also has a way to disable the protocol but it
is enabled by default. The memory usage is bound by the specification.

For dirty tracking for the renderer, we're going with the simple route
that any glyph change marks a coarse grained dirty flag and we'll [in
the future] rebuild the entire state in the renderer. I think this will
be fine for realistic workloads, but we can reassess in the future when
we have real workloads.
2026-06-05 19:47:46 -07:00
Mitchell Hashimoto
a979b8698b terminal: hook up glyph protocol glossary to terminal state
This hooks up the glyph protocol glossary to the terminal state. This
effectively makes us handle the APC protocol for it both in Ghostty GUI
and libghostty, although we didn't implement the renderer yet.

The Zig/C libghostty API also has a way to disable the protocol but it is 
enabled by default. The memory usage is bound by the specification.

For dirty tracking for the renderer, we're going with the simple route that 
any glyph change marks a coarse grained dirty flag and we'll [in the future]
rebuild the entire state in the renderer. I think this will be fine for 
realistic workloads, but we can reassess in the future when we have
real workloads.
2026-06-05 15:36:52 -07:00
Mitchell Hashimoto
ea37f4672c fix(terminal): avoid integer overflow in selectPrev with no active matches (#12936)
Also found when test searching.

Run Ghostty debug on macOS and follow these steps:

1. Open Ghostty, `cat src/Surface.zig` and start search
`self.startClipboardRequest`.
2. Click up button(Press enter) 6 times and click down button (Press
shift+enter) 6 times.
3. You should see a panic crash.

### AI Disclosure
Claude implemented the fix and the unit test.

I reviewed it and tested it myself.
2026-06-05 15:10:35 -07:00
Lukas
1e63834cdc fix(terminal): avoid integer overflow in selectPrev with no active matches 2026-06-05 23:30:58 +02:00
Claude Opus 4.8
bd365e1aa9 terminal: cover selection drop when all matches disappear
selectPrev's wrap (active_len + history_len - 1) would underflow if a
selection were live while both result lists are empty. Add a test that
exercises the invariant making that unreachable: overwriting the only match
forces a reload that empties both lists and drops the selection, so the next
select() hits the no-matches guard instead of the wrap arithmetic.
2026-06-05 23:21:27 +02:00
Lukas
d6494544cf terminal: add panic test for integer overflow in selectPrev with no active matches 2026-06-05 23:15:15 +02:00
Mitchell Hashimoto
5a1edfb254 fix(terminal): guard wrap count when resize pushes cursor to scrollback (#12935)
Found this issue when testing some search features; follow up for
#12907.

You can either reproduce using the PoC below with `libghostty-vt` or run
Ghostty debug on macOS and follow these steps:

1. Open Ghostty and start search `0`.
2. Press `cmd+=` to increase font size.
3. You should see a panic crash.

### AI Disclosure

As the commit suggests, Claude implemented the fix, the unit test, and
PoC file.

I reviewed it(seems reasonable to me, but I’m not a Zig professional)
and tested it myself.


```zig
// PoC: resize panic when shrinking both axes with the cursor near the top
// of a fully-populated screen.
//
// Build (with libghostty-vt headers + dylib on the standard search paths):
//   zig run poc.zig -lghostty-vt
//
// Or point at a local build:
//   zig run poc.zig -I <prefix>/include -L <prefix>/lib -lghostty-vt
//
// At runtime the dylib must be discoverable (DYLD_LIBRARY_PATH on macOS,
// LD_LIBRARY_PATH on Linux, or an rpath baked in at link time).
//
// Without the fix, this aborts with
//   reached unreachable code   (assert in PageList.Pin.pageIterator)
// at _terminal.PageList.resizeCols on a debug/safe build. On release it
// silently iterates an empty (reversed) range.

const std = @import("std");
const c = @cImport({
    @cInclude("ghostty/vt.h");
});

pub fn main() !void {
    var term: c.GhosttyTerminal = null;
    const opts: c.GhosttyTerminalOptions = .{
        .cols = 80,
        .rows = 24,
        .max_scrollback = 1000,
    };
    if (c.ghostty_terminal_new(null, &term, opts) != c.GHOSTTY_SUCCESS) {
        return error.InitFailed;
    }
    defer c.ghostty_terminal_free(term);

    // Fill every one of the 24 active rows with non-blank content. This is
    // what makes the bug reachable: when rows shrink, resizeWithoutReflow
    // can only trim *blank* trailing rows, so non-blank rows are instead
    // pushed up into scrollback and the active-area top moves down.
    {
        var buf: [256]u8 = undefined;
        var i: usize = 0;
        while (i < 24) : (i += 1) {
            // "X" on each row; CR+LF between rows but not after the last so
            // we don't scroll the top row away.
            const line = if (i + 1 < 24)
                std.fmt.bufPrint(&buf, "X\r\n", .{}) catch unreachable
            else
                std.fmt.bufPrint(&buf, "X", .{}) catch unreachable;
            c.ghostty_terminal_vt_write(term, line.ptr, line.len);
        }
    }

    // CSI 1;1H -> park the cursor on the TOP row (1-based). The active area is
    // anchored to the bottom, so once we shrink rows this row falls above the
    // new active-area top, i.e. into scrollback.
    const move = "\x1b[1;1H";
    c.ghostty_terminal_vt_write(term, move.ptr, move.len);

    // Shrink both axes. Columns must shrink to take resize()'s .lt branch,
    // which runs the row shrink first and then resizeCols with the original
    // (now out-of-active-area) cursor pin. Panics in
    // _terminal.PageList.resizeCols.
    _ = c.ghostty_terminal_resize(term, 79, 20, 8, 16);

    std.debug.print("survived resize (fix is present)\n", .{});
}
```
2026-06-05 13:56:58 -07:00
Mitchell Hashimoto
179fe571d7 terminal: Glyph Protocol Glossary and request handler implementation (#12930)
This adds the glossary and request handler logic to the glyph protocol
package.

We now have a fully spec compliant business-logic part of the glyph
protocol.

**This doesn't yet hook it up to terminal state.** So it isn't impacting
any real-world usage yet.

Code was hand-written, tests were AI-assisted and human reviewed.
2026-06-05 13:55:42 -07:00
Mitchell Hashimoto
aab0f8079f Revert "font: add exact glyph protocol constraints"
This reverts commit b661adad2e.
2026-06-05 13:44:43 -07:00
Mitchell Hashimoto
b661adad2e font: add exact glyph protocol constraints
Extend glyph render constraints with cell-span sizing modes for height,
width, contain, cover bounds, and stretch bounds. These preserve the
existing face-targeted behavior for platform fonts, emoji, and Nerd Font
rules while giving registered glyphs a target based on terminal cell
spans.

Map Glyph Protocol registration options to the new constraint modes so
sizing follows the spec formulas based on authored advance width and line
height. Baseline alignment now places design-space y=0 on the terminal
text baseline instead of approximating it as start alignment.

Document the placement formulas in the local protocol summary and add
focused tests for constraint mapping, cell-span padding, line-height and
advance scaling, contain versus cover behavior, stretch, and baseline
placement.
2026-06-05 13:37:10 -07:00
Mitchell Hashimoto
e45f002d1a terminal/apc: reject malformed glyph register input
Register parsing now validates the full register request shape before
constructing the parsed command. Inputs that only contain the verb
separator, such as `r`, `r;cp=e0a0`, or `r;foo`, now fail with
InvalidFormat instead of reaching Register invariants guarded by asserts.

Valid empty-payload requests still parse when they include the payload
separator, allowing execution to report malformed_payload through the
normal protocol response path.
2026-06-05 13:19:00 -07:00
Mitchell Hashimoto
f0d81f15ee terminal/apc: reject malformed glyph clear cp
Glyph clear execution previously treated an unparsable cp option the same
as an omitted cp option. That made inputs such as c;cp=zz behave like a
bare clear request and remove every glossary registration.

Track clear option presence separately from successful decoding. A
present but malformed cp now returns a malformed_payload clear failure
without mutating the glossary, while an omitted cp still clears all
registrations.
2026-06-05 13:13:04 -07:00
Mitchell Hashimoto
05eeb43942 font: exclude libghostty-vt from embedded font tests 2026-06-05 13:09:09 -07:00
Claude Opus 4.8
7837563ed6 fix(terminal): guard wrap count when resize pushes cursor to scrollback
In the column-shrink (.lt) branch of PageList.resize, resizeWithoutReflow
lowers self.rows before resizeCols runs. Because the active area is anchored
to the bottom, shrinking rows moves the active-area top down; a cursor near
the top of the old active area then ends up above the new active area (in
scrollback).

resizeCols counts wrap continuations from the cursor pin up to the active-area
top via a .left_up rowIterator. When the cursor pin is above the limit, the
range is reversed and the iterator's order assertion fires (SIGABRT in debug;
silently iterates empty in release).

Count zero wraps when the cursor pin is above the active area, mirroring the
post-reflow preserved-cursor block which already no-ops for a non-active
cursor. Add a regression test.
2026-06-05 21:03:11 +02:00