Commit Graph

14228 Commits

Author SHA1 Message Date
Mitchell Hashimoto
8bc3cdcf7d nushell: refactor ssh wrapper for clarity (#10490)
The ssh wrapper previously used a separate set_ssh_terminfo function
that returned a record to be merged, which result in some redundant
control flow and TERM assignments.

This inlines the terminfo logic and builds env/opts incrementally based
on feature flags. TERM is set to a fallback early and only overridden on
success, which simplifies our error handling and avoids mutable variable
capture issues in closures.

Lastly, warnings are now consistently written to stderr, and I made
various other control flow and syntax improvements.
2026-02-02 08:37:47 -08:00
Jon Parise
8bd02df5f6 elvish: always report current directory changes (#10533)
This reporting shouldn't have been tied to the 'title' shell features.
That's a different feature where we change the window title (icon) to
reflect the current command using OSC 2.
2026-02-02 11:32:56 -05:00
Jon Parise
37a534b747 elvish: always report current directory changes
This reporting shouldn't have been tied to the 'title' shell features.
That's a different feature where we change the window title (icon) to
reflect the current command using OSC 2.
2026-02-02 11:06:47 -05:00
Mitchell Hashimoto
1b7a15899a build(deps): bump namespacelabs/nscloud-cache-action from 1.2.21 to 1.3.0 (#10527)
Bumps
[namespacelabs/nscloud-cache-action](https://github.com/namespacelabs/nscloud-cache-action)
from 1.2.21 to 1.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/namespacelabs/nscloud-cache-action/releases">namespacelabs/nscloud-cache-action's
releases</a>.</em></p>
<blockquote>
<h2>v1.3.0</h2>
<h2>What's Changed</h2>
<p>We've increased the number of cache modes, see our docs for the full
list.
<a
href="https://namespace.so/docs/reference/github-actions/nscloud-cache-action#cache">https://namespace.so/docs/reference/github-actions/nscloud-cache-action#cache</a></p>
<p><strong>Changes:</strong></p>
<ul>
<li>🧑‍🚀 backs action with space cli by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/48">namespacelabs/nscloud-cache-action#48</a></li>
<li>Handle debug logs &amp; JSON response by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/50">namespacelabs/nscloud-cache-action#50</a></li>
<li>bump package versions for <code>@​actions/core</code>,
<code>@​actions/exec</code> and <code>@​actions/io</code> by <a
href="https://github.com/annervisser"><code>@​annervisser</code></a> in
<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/51">namespacelabs/nscloud-cache-action#51</a></li>
<li>support <code>pre-release</code> for space version by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/52">namespacelabs/nscloud-cache-action#52</a></li>
<li>ci: Enable dependabot by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/53">namespacelabs/nscloud-cache-action#53</a></li>
<li>ci: setup formatting &amp; linting by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/58">namespacelabs/nscloud-cache-action#58</a></li>
<li>ci: basic checks in merge group by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/59">namespacelabs/nscloud-cache-action#59</a></li>
<li>Bump actions/setup-node from 4 to 6 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/55">namespacelabs/nscloud-cache-action#55</a></li>
<li>Bump <code>@​types/node</code> from 24.10.9 to 25.0.10 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/56">namespacelabs/nscloud-cache-action#56</a></li>
<li>Bump vitest from 4.0.17 to 4.0.18 in the minor-npm-dependencies
group by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/54">namespacelabs/nscloud-cache-action#54</a></li>
<li>Bump actions/checkout from 4 to 6 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/57">namespacelabs/nscloud-cache-action#57</a></li>
<li>Install latest dev release by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/62">namespacelabs/nscloud-cache-action#62</a></li>
<li>Bump prettier from 2.8.8 to 3.8.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/60">namespacelabs/nscloud-cache-action#60</a></li>
<li>Bump eslint from 8.57.1 to 9.39.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/61">namespacelabs/nscloud-cache-action#61</a></li>
<li>ci: verify across space versions by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/63">namespacelabs/nscloud-cache-action#63</a></li>
<li>Capture JSON error messages from space binary by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/65">namespacelabs/nscloud-cache-action#65</a></li>
<li>fixed existing files when mounting by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/66">namespacelabs/nscloud-cache-action#66</a></li>
<li>ci: trigger errors by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/68">namespacelabs/nscloud-cache-action#68</a></li>
<li>ci: fix job name by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/70">namespacelabs/nscloud-cache-action#70</a></li>
<li>fix: revert <code>cache</code> input deprecation by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/69">namespacelabs/nscloud-cache-action#69</a></li>
<li>Switch to space as the default by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/71">namespacelabs/nscloud-cache-action#71</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
made their first contribution in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/55">namespacelabs/nscloud-cache-action#55</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/namespacelabs/nscloud-cache-action/compare/v1.2.21...v1.3.0">https://github.com/namespacelabs/nscloud-cache-action/compare/v1.2.21...v1.3.0</a></p>
<h2>v1.3.0-beta.4</h2>
<h2>What's Changed</h2>
<ul>
<li>ci: verify across space versions by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/63">namespacelabs/nscloud-cache-action#63</a></li>
<li>Capture JSON error messages from space binary by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/65">namespacelabs/nscloud-cache-action#65</a></li>
<li>fixed existing files when mounting by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/66">namespacelabs/nscloud-cache-action#66</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/namespacelabs/nscloud-cache-action/compare/v1.3.0-beta.3...v1.3.0-beta.4">https://github.com/namespacelabs/nscloud-cache-action/compare/v1.3.0-beta.3...v1.3.0-beta.4</a></p>
<h2>v1.3.0-beta.3</h2>
<h2>What's Changed</h2>
<ul>
<li>bump package versions for <code>@​actions/core</code>,
<code>@​actions/exec</code> and <code>@​actions/io</code> by <a
href="https://github.com/annervisser"><code>@​annervisser</code></a> in
<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/51">namespacelabs/nscloud-cache-action#51</a></li>
<li><del>support <code>pre-release</code> for space version by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/52">namespacelabs/nscloud-cache-action#52</a></del></li>
<li>ci: Enable dependabot by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/53">namespacelabs/nscloud-cache-action#53</a></li>
<li>ci: setup formatting &amp; linting by <a
href="https://github.com/rcrowe"><code>@​rcrowe</code></a> in <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/pull/58">namespacelabs/nscloud-cache-action#58</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a4cc4697b9"><code>a4cc469</code></a>
Switch to space as the default (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/71">#71</a>)</li>
<li><a
href="8ade02dc35"><code>8ade02d</code></a>
fix: revert <code>cache</code> input deprecation (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/69">#69</a>)</li>
<li><a
href="d200aa41f3"><code>d200aa4</code></a>
ci: fix job name (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/70">#70</a>)</li>
<li><a
href="57a17a7677"><code>57a17a7</code></a>
ci: trigger errors (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/68">#68</a>)</li>
<li><a
href="5036d7df7d"><code>5036d7d</code></a>
fixed existing files when mounting (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/66">#66</a>)</li>
<li><a
href="ed34f8f280"><code>ed34f8f</code></a>
Capture JSON error messages from space binary (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/65">#65</a>)</li>
<li><a
href="fb9650da43"><code>fb9650d</code></a>
ci: verify across space versions (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/63">#63</a>)</li>
<li><a
href="04eee14069"><code>04eee14</code></a>
Bump eslint from 8.57.1 to 9.39.2 (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/61">#61</a>)</li>
<li><a
href="6e05bb96f0"><code>6e05bb9</code></a>
Bump prettier from 2.8.8 to 3.8.1 (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/60">#60</a>)</li>
<li><a
href="a4c5fbec31"><code>a4c5fbe</code></a>
Install latest dev release (<a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/62">#62</a>)</li>
<li>Additional commits viewable in <a
href="446d8f3905...a4cc4697b9">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=namespacelabs/nscloud-cache-action&package-manager=github_actions&previous-version=1.2.21&new-version=1.3.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>
2026-02-01 19:49:24 -08:00
Mitchell Hashimoto
8c3833aeb1 build(deps): bump namespacelabs/nscloud-setup-buildx-action from 0.0.21 to 0.0.22 (#10528)
Bumps
[namespacelabs/nscloud-setup-buildx-action](https://github.com/namespacelabs/nscloud-setup-buildx-action)
from 0.0.21 to 0.0.22.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="f5814dcf37"><code>f5814dc</code></a>
Add tag input for named builder selection (<a
href="https://redirect.github.com/namespacelabs/nscloud-setup-buildx-action/issues/14">#14</a>)</li>
<li><a
href="a204134a6b"><code>a204134</code></a>
build(deps): bump lodash from 4.17.21 to 4.17.23 (<a
href="https://redirect.github.com/namespacelabs/nscloud-setup-buildx-action/issues/13">#13</a>)</li>
<li>See full diff in <a
href="a7e5254161...f5814dcf37">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=namespacelabs/nscloud-setup-buildx-action&package-manager=github_actions&previous-version=0.0.21&new-version=0.0.22)](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>
2026-02-01 19:49:12 -08:00
dependabot[bot]
c87db66631 build(deps): bump namespacelabs/nscloud-setup-buildx-action
Bumps [namespacelabs/nscloud-setup-buildx-action](https://github.com/namespacelabs/nscloud-setup-buildx-action) from 0.0.21 to 0.0.22.
- [Release notes](https://github.com/namespacelabs/nscloud-setup-buildx-action/releases)
- [Commits](a7e5254161...f5814dcf37)

---
updated-dependencies:
- dependency-name: namespacelabs/nscloud-setup-buildx-action
  dependency-version: 0.0.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-02 00:22:09 +00:00
dependabot[bot]
8714db8ea7 build(deps): bump namespacelabs/nscloud-cache-action
Bumps [namespacelabs/nscloud-cache-action](https://github.com/namespacelabs/nscloud-cache-action) from 1.2.21 to 1.3.0.
- [Release notes](https://github.com/namespacelabs/nscloud-cache-action/releases)
- [Commits](446d8f3905...a4cc4697b9)

---
updated-dependencies:
- dependency-name: namespacelabs/nscloud-cache-action
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-02 00:22:00 +00:00
Mitchell Hashimoto
769fff5dfb inspector: redraw on timed updates rather than on-demand (#10526)
Fixes #10524 

This changes our inspector from being renderer-change driven to being
FPS driven. Both macOS and GTK now draw the inspector at most at 30 FPS
on a timer. Details between platforms are slightly different and covered
later.

The motivation for this is that triggering an inspector redraw on frame
update was causing _too many_ draws, leading to high CPU usage. Further,
terminal change isn't a good proxy for all the state that the inspector
shows, and tracking changes to all those to trigger a redraw is just a
lot of complexity.

Instead, moving to a standard, game-like framerate driven redraw
simplifies a lot. It does cost some CPU when idle, but actually lowers
our CPU under normal usage since it's rendering less often (30 FPS isn't
much for what we're doing).

**For macOS,** this uses CADisplayLink, so the refresh rate is variable.
I've seen macOS drop it to 1fps when there isn't much happening, which
is nice. We also setup an occlusion event so when the window is fully
occluded we stop rendering entirely.

**For GTK,** the tools to control this are limited. We do a standard
max-30 FPS tick redraw but can't support occlusion beyond what the
window server supports. For Wayland, I believe we get it for free
(occluded windows aren't drawn).
2026-02-01 14:40:46 -08:00
Mitchell Hashimoto
2d02e4bb54 remove redraw_inspector message 2026-02-01 14:32:37 -08:00
Mitchell Hashimoto
63f9d4aaf7 apprt/gtk: move imgui widget to frame timer redraw 2026-02-01 14:30:53 -08:00
Mitchell Hashimoto
020fe35c48 macos: render inspectors on timed updates, pause when occluded 2026-02-01 14:22:10 -08:00
Mitchell Hashimoto
446b26bb72 renderer: don't ever redraw the inspector. Not your job! 2026-02-01 14:10:33 -08:00
Mitchell Hashimoto
ca1ee7d2c4 renderer: don't draw overlay if it isn't needed
This avoids loud log messages when no overlay is present.
2026-02-01 13:18:35 -08:00
Mitchell Hashimoto
4abbce287c Rewritten semantic prompt state management (OSC 133) (#10455)
Fixes #5932 

This updates our core terminal internals to track [semantic prompts
(OSC133)](https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md)
in a way that can enable us to fully implement the specification. This
PR makes our terminal state fully handle all specified sequences
properly, but we still ignore some noted options (`aid`, `cl`, etc.)
that are not critical to functionality.

I took a look at our shell integrations and they should still be
accurate and correct with regards to their OSC133 usage.

This doesn't introduce any new functionality, but should result in
existing functionality being more correct, more robust, and gives us the
groundwork to do more with semantic prompts in the future.

> [!NOTE]
>
> This PR description is **fully human written.** I realize its layout
and use of headers may trigger AI smells. But it's all me, I promise. :)

## Extensions

I kept support for the Kitty `redraw=0` extension: if an OSC133A command
sets `redraw=0` then we will NOT clear the prompt on resize (assuming
the shell can NOT redraw the prompt). I don't actually know any scripts
that utilize this, so we may want to just throw it away, but we had
support before and it's cheap to keep around and it's tested.

## Limitations, Missing Features

* We don't currently respect `aid` so nested semantic zones can break
things. This would require significant rework since aids are arbitrary
strings. It'd require managed memory on pages to store the aids. Fwiw,
in my brief survey of popular mainstream terminals, I wasn't able to
find any that respect this. Maybe Warp does since semantic prompts are
so core to their product but its not OSS for me to verify.

## Internal Changes

### `terminal.Page`

The internal state now tracks the current _semantic content type_ via a
2-bit flag on each `Cell`:

* `output` (zero value) - Command output
* `input` - Prompt input, typed by the user
* `prompt` - Prompt itself, e.g. `user@host $`

In addition to this, each `Row` also has a 2-bit flag. This flag _only
tracks if the row might contain a prompt_:

* `no_prompt` (zero value) - No prompt cells
* `prompt` - Prompt cells exist and this started the prompt (OSC133 A)
* `prompt_continuation` - Prompt cells exist and this continued a prior
prompt (OSC 133 A `k=s` or `k=c`)

The row flags server two functions:

1. An optimization to make prompt scanning faster
2. The only place the existence of continuation vs primary prompt is
stored since cells themselves only store `prompt`

### `terminal.PageList`

The PageList has two new functions:

* `promptIterator` - An iterator that yields `Pin` values that map to
the _first line_ of a prompt.
* `highlightSemanticContent` - Returns a highlight (pin range) to map to
specific semantic content for a given prompt pin. This lets you quickly
grab stuff like the prompt lines, content lines, etc.

### `terminal.Screen`

* The Screen now has a flag that tracks whether we've seen any row
trigger a semantic prompt. This can be used as a fast path to avoid
expensive semantic prompt operations if we know our screen can't
possibly contain any. We don't currently use this but I plan to.

* **Big one: clearing the prompt lines is now built-in to resize.** This
makes our resize aware of semantic prompts which makes it work _so much
better_ already.

### `terminal.Terminal`

* A new function `semanticPrompt` for handling all the semantic prompt
operations.

**AI Disclosure:** AI was used in various ways throughout this. It is by
no means 100% AI-written, it's mostly human written. I reviewed
everything. AI was used mostly for some assistance on rote tasks.
2026-02-01 13:04:43 -08:00
Mitchell Hashimoto
a909a1f120 terminal: mark newlines for input lines as prompt continuation rows 2026-02-01 13:01:03 -08:00
Mitchell Hashimoto
e05a76b5cf Update iTerm2 colorschemes (#10512)
Upstream release:
https://github.com/mbadolato/iTerm2-Color-Schemes/releases/tag/release-20260126-150817-02c580d
2026-01-31 21:31:27 -08:00
Mitchell Hashimoto
8811d9b055 terminal: for prompt redraw, assume at a prompt if at input line
Nu properly marks input areas with OSC 133 B, but if it spans multiple
lines it doesn't mark the continuation lines with the k=s sequence.

Our prompt redraw logic before only cleared explicitly designated prompt
lines. But if the input line is multi-line and the continuation lines
are not marked, those lines would not be cleared, leading to visual
issues on resize.

To workaround this, we assume that if the current cursor semantic
content is anything other than "command output" (default), then we're
probably at a prompt line and should clear from there all the way up.
2026-01-31 20:59:31 -08:00
Mitchell Hashimoto
853fee9496 terminal: when semantic cursor is prompt, assume newline is prompt
This works around Fish (at least v4.2) having a non-compliant OSC133 
implementation paired with not having the hooks to fix this via shell
integration. We have to instead resort to heuristics in the terminal
emulator. Womp, womp.

The issue is that Fish does not emit OSC133 secondary prompt (`k=s`)
markers at the beginning of continuation lines. And, since Fish doesn't
provide a PS2-equivalent, we can't do this via shell integration.

We fix this by assuming on newline (`\n`) that a cursor that is already
painting prompt cells is continuing a prior prompt line, and
pre-emptively mark it as a prompt line. But this has two further issues
we have to work around:

  1. Newline/index (`\n`) is one of the _hottest path_ functions in
     terminal emulation. It sucks to add any new conditional logic here.
     We do our best to gate this on unlikely conditions that the branch
     predictor can easily optimize away.

  2. Fish also emits these for auto-complete hints that may be deleted 
     later. So, we also have to handle the scenario where a prompt is 
     continued, then replaced by command output, and fix up the prompt 
     continuation flag to go back to output mode.

Point 2 is ALMOST automatically handled, because Fish does emit a `CSI J`
(erase display below) to erase the auto-complete hint. This resets all
our rows back to output rows. **Unfortunately**, Fish emits `\n` before
triggering the preexec hooks which set OSC133C. So we get the newline
logic FIRST (sets the prompt line), THEN sets the output cursor. If they
switched ordering here everything would just work (with the one
heuristic). But now, we need two!

To address this, I put some extra heuristic logic in the OSC133C
(output starting) handler: if our row is marked as a prompt AND our 
cursor is at x=0, we assume that the prompt continuation was deleted
and we unmark it. 

I put the heuristic logic dependent on OSC133C because that's way colder
of a path than putting something in `printCell` (which is the actual
hottest path in Ghostty).

We could get more rigorous here by also checking if every cell is empty
but that doesn't seem to be necessary at this time for any Fish version
I've tested. I hope thats correct.

I'd really love for Fish to improve their OSC133 implementation to
conform more closely to the terminal-wg spec, but we're going to need
these workarounds indefinitely to handle older Fish versions anyway.
2026-01-31 20:45:01 -08:00
Mitchell Hashimoto
92d6dde583 shell-integration/zsh: set proper input and secondary prompt marks 2026-01-31 19:34:02 -08:00
mitchellh
ef2c90cd2b deps: Update iTerm2 color schemes 2026-02-01 00:20:14 +00:00
Mitchell Hashimoto
918c2934a3 terminal: add redraw=last for bash for OSC133 2026-01-31 15:26:14 -08:00
Mitchell Hashimoto
4bee8202a8 shell-integration/bash: mark each line in multiline prompts as secondary
Insert OSC 133 A k=s marks after each newline in PS1, so that all lines
following the first are marked as secondary prompts. This prevents ghostty
from erasing leading lines during terminal resize.
2026-01-31 14:46:18 -08:00
Mitchell Hashimoto
e7e3903151 inspector: show if we've seen semantic content in screen 2026-01-31 13:41:54 -08:00
Mitchell Hashimoto
f14a1306cd renderer: semantic prompt overlay 2026-01-31 13:31:40 -08:00
Mitchell Hashimoto
a4b7a766fe PR review 2026-01-31 11:03:21 -08:00
Mitchell Hashimoto
c3e15a5cb6 terminal: rename semantic prompt 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
5f77b0ed98 terminal: remove old semantic_prompt 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
1b2376d366 terminal: remove last semantic_prompt usage from Terminal 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
10bc88766b terminal: soft wrap preserves new semantic prompt state 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
917a42876e terminal: cursorIsAtPrompt uses new APIs 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
112db8211d terminal: remove clearPrompt and integrate it into resize 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
0f05c2b71a terminal: fix resize test to use new semantic prompt logic 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
3aaafa2dda terminal: Screen testWriteString should set prompt_continuation for soft 2026-01-31 11:01:03 -08:00
Mitchell Hashimoto
047914c7b5 terminal: promptPath uses new semantic_prompt logic 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
ed0979cb0c terminal: selectOutput uses new semantic prompt logic 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
142f8ca6db terminal: Screen.selectLine uses new semantic boundaries 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
b62ac468dc terminal: change Screen.resize to take an options struct 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
07dce38cc5 terminal: Screen tracks semantic content seen 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
fd016fdb2a terminal: move cursor semantic content functions into Screen 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
4dd5df6c05 terminal: PageList.highlightSemanticContent 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
f9aa759767 terminal: promptIterator needs to respect limits 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
c74889124a terminal: PageList uses new semantic_prompt2 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
123e4ea325 terminal: PageList delta_prompt scroll uses new promptIterator 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
3c0fe02238 terminal: PageList.promptIterator 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
a80b3f34c0 terminal: add semantic_prompt2 to Row to track prompt state 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
84cfb9de1c restore old marking behavior so everything keeps working 2026-01-31 11:01:02 -08:00
Mitchell Hashimoto
ae65998d5b terminal: OSC 133;I 2026-01-31 11:01:01 -08:00
Mitchell Hashimoto
4d555f878e terminal: OSC 133 N 2026-01-31 11:01:01 -08:00
Mitchell Hashimoto
af12241d88 terminal: OSC 133 P 2026-01-31 11:01:01 -08:00
Mitchell Hashimoto
acd7a448e1 terminal: OSC 133 B handling 2026-01-31 11:01:01 -08:00