Commit Graph

15212 Commits

Author SHA1 Message Date
Mitchell Hashimoto
332b2aefc6 1.3.1 v1.3.1 2026-03-13 09:00:30 -07:00
Mitchell Hashimoto
f3ac604fff macos: select tab applescript command should not activate application (#11459)
Related to #11457
2026-03-13 08:53:53 -07:00
Mitchell Hashimoto
4c4e83784c macos: new tab applescript command should not activate application
Related to #11457
2026-03-13 08:49:22 -07:00
Jeffrey C. Ollie
d4019fa484 build(deps): bump dorny/paths-filter from 3.0.2 to 4.0.0 (#11436)
Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from
3.0.2 to 4.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dorny/paths-filter/releases">dorny/paths-filter's
releases</a>.</em></p>
<blockquote>
<h2>v4.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>feat: update action runtime to node24 by <a
href="https://github.com/saschabratton"><code>@​saschabratton</code></a>
in <a
href="https://redirect.github.com/dorny/paths-filter/pull/294">dorny/paths-filter#294</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/saschabratton"><code>@​saschabratton</code></a>
made their first contribution in <a
href="https://redirect.github.com/dorny/paths-filter/pull/294">dorny/paths-filter#294</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/dorny/paths-filter/compare/v3.0.3...v4.0.0">https://github.com/dorny/paths-filter/compare/v3.0.3...v4.0.0</a></p>
<h2>v3.0.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Add missing predicate-quantifier by <a
href="https://github.com/wardpeet"><code>@​wardpeet</code></a> in <a
href="https://redirect.github.com/dorny/paths-filter/pull/279">dorny/paths-filter#279</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/wardpeet"><code>@​wardpeet</code></a>
made their first contribution in <a
href="https://redirect.github.com/dorny/paths-filter/pull/279">dorny/paths-filter#279</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/dorny/paths-filter/compare/v3...v3.0.3">https://github.com/dorny/paths-filter/compare/v3...v3.0.3</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md">dorny/paths-filter's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>v4.0.0</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/294">Update
action runtime to node24</a></li>
</ul>
<h2>v3.0.3</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/279">Add
missing predicate-quantifier</a></li>
</ul>
<h2>v3.0.2</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/224">Add
config parameter for predicate quantifier</a></li>
</ul>
<h2>v3.0.1</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/133">Compare
base and ref when token is empty</a></li>
</ul>
<h2>v3.0.0</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/210">Update to
Node.js 20</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/215">Update
all dependencies</a></li>
</ul>
<h2>v2.11.1</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/167">Update
<code>@​actions/core</code> to v1.10.0 - Fixes warning about deprecated
set-output</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/168">Document
need for pull-requests: read permission</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/164">Updating
to actions/checkout@v3</a></li>
</ul>
<h2>v2.11.0</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/157">Set
list-files input parameter as not required</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/161">Update
Node.js</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/162">Fix
incorrect handling of Unicode characters in exec()</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/163">Use
Octokit pagination</a></li>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/160">Updates
real world links</a></li>
</ul>
<h2>v2.10.2</h2>
<ul>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/91">Fix
getLocalRef() returns wrong ref</a></li>
</ul>
<h2>v2.10.1</h2>
<ul>
<li><a
href="https://redirect.github.com/dorny/paths-filter/pull/85">Improve
robustness of change detection</a></li>
</ul>
<h2>v2.10.0</h2>
<ul>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/82">Add
ref input parameter</a></li>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/83">Fix
change detection in PR when pullRequest.changed_files is
incorrect</a></li>
</ul>
<h2>v2.9.3</h2>
<ul>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/78">Fix
change detection when base is a tag</a></li>
</ul>
<h2>v2.9.2</h2>
<ul>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/75">Fix
fetching git history</a></li>
</ul>
<h2>v2.9.1</h2>
<ul>
<li><a href="https://redirect.github.com/dorny/paths-filter/pull/74">Fix
fetching git history + fallback to unshallow repo</a></li>
</ul>
<h2>v2.9.0</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9d7afb8d21"><code>9d7afb8</code></a>
Update CHANGELOG for v4.0.0</li>
<li><a
href="782470c5d9"><code>782470c</code></a>
Merge branch 'releases/v3'</li>
<li><a
href="d1c1ffe024"><code>d1c1ffe</code></a>
Update CHANGELOG for v3.0.3</li>
<li><a
href="ce10459c8b"><code>ce10459</code></a>
Merge pull request <a
href="https://redirect.github.com/dorny/paths-filter/issues/294">#294</a>
from saschabratton/master</li>
<li><a
href="5f40380c54"><code>5f40380</code></a>
feat: update action runtime to node24</li>
<li><a
href="668c092af3"><code>668c092</code></a>
Merge pull request <a
href="https://redirect.github.com/dorny/paths-filter/issues/279">#279</a>
from wardpeet/patch-1</li>
<li><a
href="209e61402d"><code>209e614</code></a>
Add missing predicate-quantifier</li>
<li>See full diff in <a
href="de90cc6fb3...9d7afb8d21">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dorny/paths-filter&package-manager=github_actions&previous-version=3.0.2&new-version=4.0.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 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-03-12 19:32:30 -05:00
dependabot[bot]
eccf960def build(deps): bump dorny/paths-filter from 3.0.2 to 4.0.0
Bumps [dorny/paths-filter](https://github.com/dorny/paths-filter) from 3.0.2 to 4.0.0.
- [Release notes](https://github.com/dorny/paths-filter/releases)
- [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
- [Commits](de90cc6fb3...9d7afb8d21)

---
updated-dependencies:
- dependency-name: dorny/paths-filter
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-13 00:13:53 +00:00
Ken VanDine
174aae359d snap: Don't leak LD_LIBRARY_PATH set by the snap launcher (#11431)
LD_LIBRARY_PATH was being leaked which could break some apps launched
from ghostty, such as opening configuration in a text editor.
2026-03-12 16:46:28 -04:00
Ken VanDine
64331b8c35 snap: Don't leak LD_LIBRARY_PATH set by the snap launcher 2026-03-12 16:27:54 -04:00
Mitchell Hashimoto
597e8cf1c5 macOS: fix window position when dragging split into a new window (#11429) 2026-03-12 12:14:47 -07:00
Lukas
5c51603b0b chore: make ci happy 2026-03-12 20:02:23 +01:00
Lukas
07bc888682 macOS: fix window position when dragging split into a new window 2026-03-12 19:54:41 +01:00
Lukas
3022aa05ea macOS: add test cases for drag-split 2026-03-12 19:54:12 +01:00
Lukas
d6d6fe4e58 macOS: update window cascading
Make it smaller and add comparisons between y values
2026-03-12 18:58:37 +01:00
Mitchell Hashimoto
a91e747cb1 macOS: fix window cascading (#11426)
Added test case for cascading **without moving previous window**, #11161
will follow up for more accurate cascading after this.

Fixed window cascading after last pr, now we should perform cascading
**after** showing the window.
2026-03-12 10:44:37 -07:00
Lukas
5e3866381b macOS: fix window cascading for the second window 2026-03-12 18:32:04 +01:00
Lukas
ea262cdd34 macOS: fix window cascading for 3rd+ window 2026-03-12 18:32:04 +01:00
Lukas
77c2acf843 macOS: add test case for window cascading without moving the window 2026-03-12 18:32:04 +01:00
Mitchell Hashimoto
70685733c5 macOS: fix window position for the very first window (#11421)
Depends on https://github.com/ghostty-org/ghostty/pull/11417

Moved positioning part from `windowDidLoad` to `showWindow` to make new
users happy. Also deleted `initialFrame`, since we don't need it
anymore.
2026-03-12 09:09:30 -07:00
Lukas
08107d342a macOS: we don't need initialFrame anymore 2026-03-12 15:42:29 +01:00
Lukas
4f849a1512 macOS: fix window position for the very first window 2026-03-12 15:42:29 +01:00
Lukas
c399812036 macOS: add test case for positioning the very first window 2026-03-12 15:42:28 +01:00
Mitchell Hashimoto
8dde340f88 macOS: support injecting temporary defaults when testing (#11417) 2026-03-12 07:14:12 -07:00
Lukas
d6dfaf28fe macOS: support injecting temporary defaults when testing 2026-03-12 13:16:55 +01:00
Mitchell Hashimoto
ab269e2c79 config: add progress-style option (#11289)
Adds progress-style config to control OSC 9;4 progress bar visibility.
Defaults to true, set false to hide.

Fixes #11241

AI Disclosure: Claude Code (Opus 4.6) used for codebase exploration,
code review, and testing assistance. All code written and reviewed by
hand.
2026-03-11 20:46:59 -07:00
Mitchell Hashimoto
35f4d18802 macos: only run key equivalents for Ghostty-owned menu items (#11403)
Fixes #11396

Track menu items populated from Ghostty keybind actions and only trigger
those from SurfaceView performKeyEquivalent. This avoids app-default
shortcuts such as Hide from pre-empting explicit keybinds.
2026-03-11 20:11:13 -07:00
Mitchell Hashimoto
8392255fd6 build(deps): bump actions/download-artifact from 8.0.0 to 8.0.1 (#11399)
Bumps
[actions/download-artifact](https://github.com/actions/download-artifact)
from 8.0.0 to 8.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/download-artifact/releases">actions/download-artifact's
releases</a>.</em></p>
<blockquote>
<h2>v8.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Support for CJK characters in the artifact name by <a
href="https://github.com/danwkennedy"><code>@​danwkennedy</code></a> in
<a
href="https://redirect.github.com/actions/download-artifact/pull/471">actions/download-artifact#471</a></li>
<li>Add a regression test for artifact name + content-type mismatches by
<a href="https://github.com/danwkennedy"><code>@​danwkennedy</code></a>
in <a
href="https://redirect.github.com/actions/download-artifact/pull/472">actions/download-artifact#472</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/download-artifact/compare/v8...v8.0.1">https://github.com/actions/download-artifact/compare/v8...v8.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3e5f45b2cf"><code>3e5f45b</code></a>
Add regression tests for CJK characters (<a
href="https://redirect.github.com/actions/download-artifact/issues/471">#471</a>)</li>
<li><a
href="e6d03f6737"><code>e6d03f6</code></a>
Add a regression test for artifact name + content-type mismatches (<a
href="https://redirect.github.com/actions/download-artifact/issues/472">#472</a>)</li>
<li>See full diff in <a
href="70fc10c6e5...3e5f45b2cf">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/download-artifact&package-manager=github_actions&previous-version=8.0.0&new-version=8.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-03-11 20:00:58 -07:00
Mitchell Hashimoto
8093695055 macos: only run key equivalents for Ghostty-owned menu items
Fixes #11396

Track menu items populated from Ghostty keybind actions and only trigger
those from SurfaceView performKeyEquivalent. This avoids app-default
shortcuts such as Hide from pre-empting explicit keybinds.
2026-03-11 19:59:56 -07:00
Michal Olechowski
84d48d1c6a config: add progress-style option
Add option to disable OSC 9;4 ConEmu progress bars via config.

Fixes #11241
2026-03-12 01:33:25 +01:00
dependabot[bot]
16ca9527e9 build(deps): bump actions/download-artifact from 8.0.0 to 8.0.1
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](70fc10c6e5...3e5f45b2cf)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 00:13:04 +00:00
ghostty-vouch[bot]
0f745b5673 Update VOUCHED list (#11389)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11388#discussioncomment-16087905)
from @jcollie.

Vouch: @wyounas

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-11 19:24:01 +00:00
Mitchell Hashimoto
a0d3566872 macos: only show split grab handle when the mouse is near it (#11383)
Fixes #11379

For this pass, I made it a very simple "within 20%" (height-wise) of the
split handle down. There is no horizontal component. I want to find the
right balance between always visible (today mostly) to only visible on
direct hover, because I think it'll be too hard to discover on that far
right side.
2026-03-11 10:57:34 -07:00
Mitchell Hashimoto
fe98f3884d macos: only show split grab handle when the mouse is near it
Fixes #11379

For this pass, I made it a very simple "within 20%" (height-wise) of the
split handle. There is no horizontal component. I want to find the right
balance between always visible (today mostly) to only visible on direct
hover, because I think it'll be too hard to discover on that far right
side.
2026-03-11 10:48:09 -07:00
Mitchell Hashimoto
36c1450dc9 nix: bump zig-overlay version (#11375)
Bump of `zig-overlay`, allowing us to drop flake-utils from the flake
inputs. :)
2026-03-11 10:09:12 -07:00
Mitchell Hashimoto
19e5053b28 macos: only show the grab handle in fullscreen if there are splits (#11381)
Fixes #11376
2026-03-11 10:08:25 -07:00
Mitchell Hashimoto
2296a82c13 macOS: fix window frame when (re)opening new window (#11380)
Claude wrote the fail path in the UI tests, or you can easily reproduce
this manually. This is kinda a regression after #11322, since we are not
delaying the frame update anymore, which exposes some of the "flaws" of
the previous implementation.

The following three commits fix this step by step:
- We shouldn't save intermediate frames when the window is loading,
which is triggered by `windowDidResize` and `windowDidMove` during the
process.
- We should set the initial position (from the config) after the window
is loaded.
- A small refactor on `LastWindowPosition` to support restoring the
window frame under certain conditions.


https://github.com/user-attachments/assets/6f90f9a5-653d-4146-95c6-8e5c69bda656



### AI Disclosure

Claude helped me write the UI tests.
2026-03-11 10:08:14 -07:00
Mitchell Hashimoto
12bc1e7860 macos: only show the grab handle in fullscreen if there are splits
Fixes #11376
2026-03-11 10:02:09 -07:00
Mitchell Hashimoto
7aff470ceb bash: fix extra newlines with readline vi mode indicator (#11377)
Use OSC 133;P (prompt mark) instead of 133;A (fresh line + prompt mark)
inside PS1 and PS2. Readline redraws the prompt on vi mode switches,
Ctrl-L, and other events, and 133;A's fresh-line behavior would emit a
CR+LF whenever the cursor wasn't at column 0, causing visible extra
newlines.

The one-time 133;A is now emitted via printf in __ghostty_precmd, which
only runs once per prompt cycle via PROMPT_COMMAND. On SIGWINCH, bash
redraws PS1 (firing the 133;P marks) but doesn't re-run PROMPT_COMMAND,
so there's no unwanted fresh-line on resize either. The redraw=last flag
persists from the initial printf.

This is a little less optimal than our previous approach, in terms of
number of prompt marks we emit, but it produces an overall more correct
result, which is the important thing.

Because readline prints its output outside the scope of PS1, those
characters "inherit" the surrounded prompt scope. This is usually fine,
but it can sometimes get out of sync (especially during redraws). This
is inherently a limitation of the fact that it's a separate output
channel, so we just have to accept that can happen.

Fixes: #10953
See: #11267
2026-03-11 09:54:46 -07:00
Jon Parise
e31615d00b bash: fix extra newlines with readline vi mode indicator
Use OSC 133;P (prompt mark) instead of 133;A (fresh line + prompt mark)
inside PS1 and PS2. Readline redraws the prompt on vi mode switches,
Ctrl-L, and other events, and 133;A's fresh-line behavior would emit a
CR+LF whenever the cursor wasn't at column 0, causing visible extra
newlines.

The one-time 133;A is now emitted via printf in __ghostty_precmd, which
only runs once per prompt cycle via PROMPT_COMMAND. On SIGWINCH, bash
redraws PS1 (firing the 133;P marks) but doesn't re-run PROMPT_COMMAND,
so there's no unwanted fresh-line on resize either. The redraw=last flag
persists from the initial printf.

This is a little less optimal than our previous approach, in terms of
number of prompt marks we emit, but it produces an overall more correct
result, which is the important thing.

Because readline prints its output outside the scope of PS1, those
characters "inherit" the surrounded prompt scope. This is usually fine,
but it can sometimes get out of sync (especially during redraws). This
is inherently a limitation of the fact that it's a separate output
channel, so we just have to accept that can happen.

See: #11267
2026-03-11 12:46:14 -04:00
Lukas
596d502a75 macOS: restore window frame under certain conditions 2026-03-11 17:45:10 +01:00
Lukas
45d360dc68 macOS: set the initial window position after window is loaded 2026-03-11 17:45:09 +01:00
Lukas
e8c82ca1af macOS: save frame only if the window is visible 2026-03-11 17:45:09 +01:00
Lukas
0af9938ad2 macos: add UI test for window position restore across titlebar styles
Tests that window position and size are correctly restored after
reopen for all four macos-titlebar-style variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:45:09 +01:00
faukah
9503fa0786 nix: bump zig-overlay version 2026-03-11 17:39:21 +01:00
Mitchell Hashimoto
8ad9ec8e88 add direct set_surface_title and set_tab_title actions (#11373)
Fixes #11316

This mirrors the `prompt` actions (hence why there is no window action
here) and enables setting titles via keybind actions which importantly
lets this work via command palettes, App Intents, AppleScript, etc.
2026-03-11 09:35:56 -07:00
ghostty-vouch[bot]
a8d38fe5d8 Update VOUCHED list (#11374)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11372#discussioncomment-16086042)
from @mitchellh.

Vouch: @faukah

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-11 16:28:08 +00:00
Mitchell Hashimoto
86c2a2e87f input: add direct set_surface_title and set_tab_title actions
Fixes #11316

This mirrors the `prompt` actions (hence why there is no window action
here) and enables setting titles via keybind actions which importantly
lets this work via command palettes, App Intents, AppleScript, etc.
2026-03-11 09:25:08 -07:00
Mitchell Hashimoto
d48b6ba085 ci: skip vouched PRs for milestone attachment (#11371) 2026-03-11 09:21:51 -07:00
Mitchell Hashimoto
f571c806fe ci: skip vouched PRs for milestone attachment 2026-03-11 08:38:54 -07:00
Mitchell Hashimoto
660767c77d bash: fix multiline PS1 with command substitutions (#11369)
Only replace the \n prompt escape when inserting secondary prompt marks,
not literal newlines `($'\n')`. Literal newlines may appear inside
`$(...)` or `...` command substitutions, and inserting escape sequences
there breaks the shell syntax. For example:

      PS1='$(if [ $? -eq 0 ]; then echo -e "P";
                    else echo -e "F";
                    fi) $ '

The literal newlines between the if/else/fi are part of the shell syntax
inside the command substitution. The previous code replaced all literal
newlines in PS1 with newline + OSC 133 escape sequences, which injected
terminal escapes into the middle of the command substitution and caused
bash to report a syntax error when evaluating it.

The \n prompt escape is PS1-specific and safe to replace globally. This
means prompts using literal newlines for line breaks (rather than \n)
won't get per-line secondary marks, but this is the conventional form
and avoids the need for complex shell parsing.

Fixes: #11267
2026-03-11 08:36:36 -07:00
Jon Parise
26d8bd9e71 bash: fix multiline PS1 with command substitutions
Only replace the \n prompt escape when inserting secondary prompt marks,
not literal newlines ($'\n'). Literal newlines may appear inside $(...)
or `...` command substitutions, and inserting escape sequences there
breaks the shell syntax. For example:

      PS1='$(if [ $? -eq 0 ]; then echo -e "P";
                    else echo -e "F";
                    fi) $ '

The literal newlines between the if/else/fi are part of the shell syntax
inside the command substitution. The previous code replaced all literal
newlines in PS1 with newline + OSC 133 escape sequences, which injected
terminal escapes into the middle of the command substitution and caused
bash to report a syntax error when evaluating it.

The \n prompt escape is PS1-specific and safe to replace globally. This
means prompts using literal newlines for line breaks (rather than \n)
won't get per-line secondary marks, but this is the conventional form
and avoids the need for complex shell parsing.

Fixes: #11267
2026-03-11 10:46:43 -04:00
Mitchell Hashimoto
61865bc37f zsh: improve prompt marking with dynamic themes (#11367)
Replace the strip-in-preexec / re-add-in-precmd pattern for OSC 133
marks with a save/restore approach. Instead of pattern-matching marks
out of PS1 (which exposes PS1 in intermediate states to other hooks), we
save the original PS1/PS2 before adding marks and then restore them.

This also adds dynamic theme detection: if PS1 changed between cycles
(e.g., a theme rebuilt it), we skip injecting continuation marks into
newlines. This prevents breaking plugins like Pure that use pattern
matching to strip/rebuild the prompt.

Additionally, move _ghostty_precmd to the end of precmd_functions in
_ghostty_deferred_init (instead of substituting in-place) so that the
first prompt is properly marked even when other hooks were appended
after our auto-injection.

There's one scenario that we still don't complete cover:

    precmd_functions+=(_test_overwrite_ps1)
    _test_overwrite_ps1() {
        PS1="test> "
    }

... which results in the first prompt not printing its prompt marks
because _test_overwrite_ps1 becomes the last thing to run, overwriting
our marks, but this will be fixed for subsequent prompts when we move
our handler back to the last index.

Fixes: #11282
2026-03-11 07:30:02 -07:00