Commit Graph

15385 Commits

Author SHA1 Message Date
Mitchell Hashimoto
00ffc22ecb libghostty: starting render state API in C (#11664)
This adds the `terminal.RenderState` API for C. 

The render state API is the API that should be used to create a high
performance renderer. It limits access to a terminal instance to a very
optimized `update` call so that terminal IO is blocked for a tiny amount
of time. After that, all read access on the RenderState is safe to build
frame data.

## Example

```c
int main(void) {
  GhosttyResult result;

  GhosttyTerminal terminal = NULL;
  GhosttyTerminalOptions terminal_opts = {
      .cols = 80,
      .rows = 24,
      .max_scrollback = 10000,
  };
  result = ghostty_terminal_new(NULL, &terminal, terminal_opts);
  assert(result == GHOSTTY_SUCCESS);

  GhosttyRenderState render_state = NULL;
  result = ghostty_render_state_new(NULL, &render_state);
  assert(result == GHOSTTY_SUCCESS);

  const char* first_frame = "first frame\r\n";
  ghostty_terminal_vt_write(
      terminal,
      (const uint8_t*)first_frame,
      strlen(first_frame));
  result = ghostty_render_state_update(render_state, terminal);
  assert(result == GHOSTTY_SUCCESS);

  const char* second_frame = "second frame\r\n";
  ghostty_terminal_vt_write(
      terminal,
      (const uint8_t*)second_frame,
      strlen(second_frame));
  result = ghostty_render_state_update(render_state, terminal);
  assert(result == GHOSTTY_SUCCESS);

  printf("Render state was updated successfully.\n");

  ghostty_render_state_free(render_state);
  ghostty_terminal_free(terminal);
  return 0;
}
```

## API Changes

New `GhosttyRenderState` C API (`include/ghostty/vt/render.h`):

| Function | Description |
|---|---|
| `ghostty_render_state_new` | Allocate an empty render state. |
| `ghostty_render_state_free` | Destroy a render state. |
| `ghostty_render_state_update` | Snapshot a terminal instance into the
render state. |
| `ghostty_render_state_get` | Type-tagged read of dimensions, dirty
state, colors, cursor, palette. |
| `ghostty_render_state_set` | Type-tagged write (currently: dirty
state). |
| `ghostty_render_state_colors_get` | Bulk color read via sized-struct
for forward compatibility. |
| `ghostty_render_state_row_iterator_new` | Allocate a reusable row
iterator. |
| `ghostty_render_state_row_iterator_next` | Advance the row iterator. |
| `ghostty_render_state_row_iterator_free` | Destroy a row iterator. |
| `ghostty_render_state_row_get` | Read per-row data (dirty flag, raw
row, cells). |
| `ghostty_render_state_row_set` | Write per-row data (dirty flag). |
| `ghostty_render_state_row_cells_new` | Allocate a reusable cell
iterator. |
| `ghostty_render_state_row_cells_next` | Advance the cell iterator. |
| `ghostty_render_state_row_cells_select` | Jump the cell iterator to a
specific column. |
| `ghostty_render_state_row_cells_get` | Read per-cell data (raw cell,
style, graphemes). |
| `ghostty_render_state_row_cells_free` | Destroy a cell iterator. |

`GhosttyRenderStateData` keys (for `_get`):

| Key | Type | Description |
|---|---|---|
| `COLS` | `uint16_t` | Viewport width in cells. |
| `ROWS` | `uint16_t` | Viewport height in cells. |
| `DIRTY` | `GhosttyRenderStateDirty` | Global dirty state. |
| `ROW_ITERATOR` | `GhosttyRenderStateRowIterator` | Populate a
pre-allocated row iterator. |
| `COLOR_BACKGROUND` | `GhosttyColorRgb` | Default background color. |
| `COLOR_FOREGROUND` | `GhosttyColorRgb` | Default foreground color. |
| `COLOR_CURSOR` | `GhosttyColorRgb` | Explicit cursor color (invalid if
not set). |
| `COLOR_CURSOR_HAS_VALUE` | `bool` | Whether an explicit cursor color
is set. |
| `COLOR_PALETTE` | `GhosttyColorRgb[256]` | Active 256-color palette. |
| `CURSOR_VISUAL_STYLE` | `GhosttyRenderStateCursorVisualStyle` | Bar,
block, underline, or hollow block. |
| `CURSOR_VISIBLE` | `bool` | Cursor visibility from terminal modes. |
| `CURSOR_BLINKING` | `bool` | Cursor blink state from terminal modes. |
| `CURSOR_PASSWORD_INPUT` | `bool` | Whether cursor is at a password
field. |
| `CURSOR_VIEWPORT_HAS_VALUE` | `bool` | Whether cursor is in the
viewport. |
| `CURSOR_VIEWPORT_X` | `uint16_t` | Cursor viewport column. |
| `CURSOR_VIEWPORT_Y` | `uint16_t` | Cursor viewport row. |
| `CURSOR_VIEWPORT_WIDE_TAIL` | `bool` | Cursor on wide-char tail cell.
|

`GhosttyRenderStateOption` keys (for `_set`):

| Key | Type | Description |
|---|---|---|
| `DIRTY` | `GhosttyRenderStateDirty` | Reset global dirty state. |

`GhosttyRenderStateRowData` keys (for `_row_get`):

| Key | Type | Description |
|---|---|---|
| `DIRTY` | `bool` | Whether this row is dirty. |
| `RAW` | `GhosttyRow` | Raw row value. |
| `CELLS` | `GhosttyRenderStateRowCells` | Populate a pre-allocated cell
iterator. |

`GhosttyRenderStateRowOption` keys (for `_row_set`):

| Key | Type | Description |
|---|---|---|
| `DIRTY` | `bool` | Clear/set dirty flag for this row. |

`GhosttyRenderStateRowCellsData` keys (for `_row_cells_get`):

| Key | Type | Description |
|---|---|---|
| `RAW` | `GhosttyCell` | Raw cell value. |
| `STYLE` | `GhosttyStyle` | Resolved style for this cell. |
| `GRAPHEMES_LEN` | `uint32_t` | Total codepoints including base (0 if
empty). |
| `GRAPHEMES_BUF` | `uint32_t*` | Write codepoints into caller buffer. |
2026-03-20 09:34:52 -07:00
Mitchell Hashimoto
e7a18ea5b3 vt: fix render state cell style and graphemes_buf APIs
The GRAPHEMES_BUF data kind previously required a double pointer
(pointer to a uint32_t*) because the OutType was [*]u32, making the
typed out parameter *[*]u32. Change OutType to u32 so that callers
pass a plain uint32_t* buffer directly, which is the natural C
calling convention. The implementation casts the out pointer to
[*]u32 internally to write into the buffer.

The STYLE data kind read directly from the render state style array
without checking whether the cell actually had non-default styling.
The style data is undefined for unstyled cells, so this caused a
panic on a corrupt enum value when the caller read the style of an
unstyled cell. Now check cell.hasStyling() first and return the
default style for unstyled cells.

Expand the c-vt-render example to exercise dirty tracking, color
retrieval, cursor state, row/cell iteration with style resolution,
and dirty state reset. Break the example into six doxygen snippet
regions and reference them from render.h.
2026-03-20 09:24:31 -07:00
Mitchell Hashimoto
d9df4154db vt: add cursor field data getters to render state API
Expose the cursor fields from RenderState.Cursor through the C API
via new GhosttyRenderStateData enum values. This adds getters for
visual style, visibility, blink state, password input detection,
and viewport position (x, y, wide tail).

A new GhosttyRenderStateCursorVisualStyle enum maps the Zig
cursor.Style values (bar, block, underline, block_hollow) to
stable C integer constants. Viewport position getters return
GHOSTTY_INVALID_VALUE when the cursor is not visible within
the viewport.
2026-03-20 09:05:20 -07:00
Mitchell Hashimoto
60ea2d76d4 vt: add color data getters to render state
Add individual color data kinds to GhosttyRenderStateData so callers
can query background, foreground, cursor color, cursor-color presence,
and the full 256-color palette through ghostty_render_state_get()
without using the sized-struct colors API.

COLOR_CURSOR returns GHOSTTY_INVALID_VALUE when no explicit cursor
color is set; callers can check COLOR_CURSOR_HAS_VALUE first.
2026-03-20 08:57:23 -07:00
Mitchell Hashimoto
6ae17a02af vt: add cell-level iteration and data access to render state row cells
Add next, select, and get functions to the render state row cells
API, mirroring the row iterator pattern. row_cells_next advances to
the next cell sequentially, row_cells_select jumps to a specific
column index with bounds validation, and row_cells_get queries data
for the current cell position.

The get function supports querying raw cell values (GhosttyCell),
resolved styles (GhosttyStyle), grapheme codepoint counts, and
writing grapheme codepoints into a caller-provided buffer.

Also add Cell.C and Cell.cval() to page.zig, matching the existing
Row.C/Row.cval() pattern, so the render state can convert cells to
the C ABI type without a raw bitCast.
2026-03-20 08:53:45 -07:00
Jeffrey C. Ollie
a888db94b0 nix: add systems input and fix zig follows (#11686)
Currently I have to use [this unusual
syntax](6e1c9f32e0/flake.nix (L137))
in my flake inputs to ensure that I don't have systems repeated in my
flake.lock file. This will make more obvious the fact that you have to
do follows to that hidden input.
2026-03-20 07:35:59 -08:00
Mitchell Hashimoto
ecd1d0d1e1 vt: decouple row iterator allocation from population
Change row_iterator_new to only allocate with undefined fields,
matching the pattern used by row_cells_new. The iterator is now
populated via the render state get API with a new .row_iterator
data kind, which slices the row data and resets y to null.

This separates the lifetime of the opaque handle from the render
state it iterates, letting callers allocate once and re-populate
from different states without reallocating.
2026-03-20 08:20:27 -07:00
Leah Amelia Chen
9c30bfadc5 gtk: various blur-related fixes (#10727) 2026-03-20 14:54:21 +00:00
Mitchell Hashimoto
75b49051a3 vt: add GhosttyRenderStateRowCells opaque type
Add a new opaque RowCells type that wraps per-row cell data
(raw cells, graphemes, styles) for the C API. The caller
allocates a RowCells handle via row_cells_new, then populates
it by passing it to row_get with the new .cells data kind.
This queries the current row from the iterator and slices the
underlying MultiArrayList into the RowCellsWrapper fields.

The new type and functions are wired through main.zig,
lib_vt.zig, and the render.h C header.
2026-03-20 07:25:52 -07:00
ghostty-vouch[bot]
46ece224ba Update VOUCHED list (#11694)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11420#discussioncomment-16227199)
from @mitchellh.

Vouch: @hlcfan

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 14:23:05 +00:00
Mitchell Hashimoto
33e81ffb75 vt: use get/set pattern for row iterator data access
Replace ghostty_render_state_row_dirty_get and
ghostty_render_state_row_dirty_set with generic
ghostty_render_state_row_get and ghostty_render_state_row_set
functions using enum-dispatched data/option kinds.
2026-03-20 07:17:00 -07:00
Mitchell Hashimoto
459583a6c3 vt: use get/set pattern for render state data access
Replace the individual ghostty_render_state_size_get,
ghostty_render_state_dirty_get, and ghostty_render_state_dirty_set
functions with generic ghostty_render_state_get and
ghostty_render_state_set functions that use enum-dispatched data
kinds and option kinds, following the same InType/OutType pattern
used by the terminal and mouse encoder C APIs.
2026-03-20 07:00:14 -07:00
ghostty-vouch[bot]
ff0ee364bb Update VOUCHED list (#11691)
Triggered by
[comment](https://github.com/ghostty-org/ghostty/issues/11686#issuecomment-4098087863)
from @mitchellh.

Vouch: @luisnquin

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 13:49:07 +00:00
Mitchell Hashimoto
e2399de38c bash: suppress __ghostty_hook errors in inherited PROMPT_COMMAND (#11690)
When some tools spawn subshells, PROMPT_COMMAND may be inherited as an
environment variable while the __ghostty_hook function is not (bash
doesn't export functions by default). This causes "command not found"
errors on every prompt in the subshell.

Add 2>/dev/null to the __ghostty_hook entry in PROMPT_COMMAND so that it
silently no-ops in subshells where the function isn't defined. This also
silences any errors from inside __ghostty_hook itself, but those are all
terminal escape sequences and non-actionable.

See: #11245
2026-03-20 06:46:49 -07:00
Jon Parise
4b9324f48a bash: suppress __ghostty_hook errors in inherited PROMPT_COMMAND
When some tools spawn subshells, PROMPT_COMMAND may be inherited as an
environment variable while the __ghostty_hook function is not (bash
doesn't export functions by default). This causes "command not found"
errors on every prompt in the subshell.

Add 2>/dev/null to the __ghostty_hook entry in PROMPT_COMMAND so that it
silently no-ops in subshells where the function isn't defined. This also
silences any errors from inside __ghostty_hook itself, but those are all
terminal escape sequences and non-actionable.

See: #11245
2026-03-20 09:41:34 -04:00
Luis Quiñones
220d6fd43d nix: add systems input and fix zig follows 2026-03-20 04:11:25 -05:00
Mitchell Hashimoto
7966740b48 bash: move __ghostty_preexec_hook into __ghostty_hook (#11674)
We previously used a readonly variable (__ghostty_ps0) to define the
best __ghostty_preexec_hook expansion for the current bash version.

This worked pretty well, but it had the downside of managing another
variable (#11258).

We can instead simplify this a bit by moving this into __ghostty_hook. I
didn't take that approach originally because I wanted to avoid the bash
version check on each command, but slightly loosening our guard check to
just look for "__ghostty_preexec_hook" (rather than the full expansion
expression) means we can bury the bash version check to the cold path.

One small gap here is that we may not update PS0 to the correct syntax
if we start switching between significantly different bash versions in
interactive subshells, but that seems like a pretty rare case to handle
given the benefits of this approach.
2026-03-19 20:13:46 -07:00
Mitchell Hashimoto
900afa7b80 fix types 2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
2147b9d65c vt: row dirty tracking 2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
f610d7e00f vt: add render_row_iterator_next 2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
ad0e47ebac vt: cover c row iterator new/free
Add a C ABI row-iterator handle for render state with
ghostty_render_state_row_iterator_new and
ghostty_render_state_row_iterator_free, and wire them through
src/terminal/c/main.zig, src/lib_vt.zig, and
include/ghostty/vt/render.h. The header now documents only the
currently exported iterator API.
2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
b35f8ed16e vt: expose render state colors in C API
Add a C-facing GhosttyRenderStateColors sized struct and a
ghostty_render_state_colors_get accessor so renderers can read
background, foreground, cursor color state, and palette data directly
from the render state.
2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
b830a0ee1d vt: add size getter for render state
Add ghostty_render_state_size_get() to return cols and rows from the
current render state using out pointers. The C wrapper validates null
inputs, the symbol is wired through the C API export layers, and tests
cover success and invalid-value paths.
2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
2876fb7a55 vt: expose dirty state in C API
Switch RenderState.Dirty to lib.Enum so it uses C-compatible enum
backing when building the C ABI target. Add GhosttyRenderStateDirty and
new ghostty_render_state_dirty_get/set declarations to the render header,
then wire both functions through src/terminal/c/main.zig and the lib_vt
export table.
2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
a0d738697e vt: add c render state api and example
Introduce the first public C render-state surface for libghostty-vt.
Before this change, the render-state path was only available in Zig,
so C embedders had no direct way to create and update that cache.

Add an opaque GhosttyRenderState type with new, update, and free
entry points, then wire those symbols through the C API bridge and
library exports. Keep the surface intentionally minimal for now so
ownership and update behavior are established before adding read
accessors.
2026-03-19 20:13:14 -07:00
Mitchell Hashimoto
d2a29de959 libghostty: terminal data, grid point and cell inspection APIs (#11676)
This adds a complete set of APIs for inspecting individual cells and
rows in the terminal grid from C. Callers can now resolve any point in
the grid to a reference, then extract codepoints, grapheme clusters,
styles, wide-character state, semantic prompt tags, and row-level
metadata like wrap and dirty flags.

This also adds a robust `ghostty_terminal_get` API for extracting
information like rows, cols, active screen, cursor information, etc.
from the terminal.

## Example

```c
// Write bold red text via SGR sequences
const char *text = "\033[1;31mHello\033[0m";
ghostty_terminal_vt_write(terminal, (const uint8_t *)text, strlen(text));

// Resolve cell (0,0) to a grid reference
GhosttyGridRef ref = GHOSTTY_INIT_SIZED(GhosttyGridRef);
GhosttyPoint pt = {
  .tag = GHOSTTY_POINT_TAG_ACTIVE,
  .value = { .coordinate = { .x = 0, .y = 0 } },
};
ghostty_terminal_grid_ref(terminal, pt, &ref);

// Read the codepoint ('H')
GhosttyCell cell;
ghostty_grid_ref_cell(&ref, &cell);
uint32_t codepoint = 0;
ghostty_cell_get(cell, GHOSTTY_CELL_DATA_CODEPOINT, &codepoint);

// Read the resolved style (bold=true, fg=red)
GhosttyStyle style = GHOSTTY_INIT_SIZED(GhosttyStyle);
ghostty_grid_ref_style(&ref, &style);
assert(style.bold);
```

## API Changes

### New Types

| Type | Description |
|------|-------------|
| `GhosttyCell` | Opaque 64-bit cell value |
| `GhosttyRow` | Opaque 64-bit row value |
| `GhosttyCellData` | Enum for `ghostty_cell_get` data kinds (codepoint,
content tag, wide, has_text, etc.) |
| `GhosttyCellContentTag` | Cell content kind (codepoint, grapheme, bg
color palette/RGB) |
| `GhosttyCellWide` | Cell width (narrow, wide, spacer tail/head) |
| `GhosttyCellSemanticContent` | Semantic content type (output, input,
prompt) |
| `GhosttyRowData` | Enum for `ghostty_row_get` data kinds (wrap,
grapheme, styled, dirty, etc.) |
| `GhosttyRowSemanticPrompt` | Row-level semantic prompt state |
| `GhosttyGridRef` | Sized struct — resolved reference to a cell
position in the page structure |
| `GhosttyPoint` | Tagged union specifying a grid position in a given
coordinate system |
| `GhosttyPointTag` | Coordinate system tag: `ACTIVE`, `VIEWPORT`,
`SCREEN`, `HISTORY` |
| `GhosttyPointCoordinate` | x/y coordinate pair |
| `GhosttyStyleId` | Style identifier type (uint16) |

### New Functions

| Function | Description |
|----------|-------------|
| `ghostty_cell_get` | Extract typed data from a cell (codepoint, wide,
style ID, etc.) |
| `ghostty_row_get` | Extract typed data from a row (wrap, dirty,
semantic prompt, etc.) |
| `ghostty_terminal_grid_ref` | Resolve a `GhosttyPoint` to a
`GhosttyGridRef` |
| `ghostty_grid_ref_cell` | Extract the `GhosttyCell` from a grid ref |
| `ghostty_grid_ref_row` | Extract the `GhosttyRow` from a grid ref |
| `ghostty_grid_ref_graphemes` | Get the full grapheme cluster
(codepoints) for the cell |
| `ghostty_grid_ref_style` | Get the resolved `GhosttyStyle` for the
cell |
2026-03-19 20:12:56 -07:00
Mitchell Hashimoto
93c597ce6b example: add grid reference traversal example
Add a c-vt-grid-ref example that demonstrates the terminal and grid
reference APIs end-to-end. The example creates a small 10x3 terminal,
writes text with mixed styles via VT sequences, then iterates over
every cell in the active area using ghostty_terminal_grid_ref. For
each cell it extracts the codepoint, and for each row it inspects
the wrap flag and the style bold attribute.

The grid_ref.h defgroup gains a @snippet reference to the new example,
and vt.h gets the corresponding @example entry and @ref listing.
2026-03-19 19:55:02 -07:00
ghostty-vouch[bot]
1f89ce91d9 Update VOUCHED list (#11675)
Triggered by [discussion
comment](https://github.com/ghostty-org/ghostty/discussions/11671#discussioncomment-16218675)
from @jcollie.

Vouch: @unphased

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-20 02:51:06 +00:00
Jeffrey C. Ollie
e9eac7d475 build(deps): bump namespacelabs/nscloud-setup from 0.0.11 to 0.0.12 (#11672)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps
[namespacelabs/nscloud-setup](https://github.com/namespacelabs/nscloud-setup)
from 0.0.11 to 0.0.12.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="df198f982f"><code>df198f9</code></a>
Update to node24 (<a
href="https://redirect.github.com/namespacelabs/nscloud-setup/issues/10">#10</a>)</li>
<li>See full diff in <a
href="f378676225...df198f982f">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=namespacelabs/nscloud-setup&package-manager=github_actions&previous-version=0.0.11&new-version=0.0.12)](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-19 18:49:26 -08:00
Jeffrey C. Ollie
4531594d51 build(deps): bump namespacelabs/nscloud-setup-buildx-action from 0.0.22 to 0.0.23 (#11673)
Bumps
[namespacelabs/nscloud-setup-buildx-action](https://github.com/namespacelabs/nscloud-setup-buildx-action)
from 0.0.22 to 0.0.23.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d059ed7184"><code>d059ed7</code></a>
Update to node24 (<a
href="https://redirect.github.com/namespacelabs/nscloud-setup-buildx-action/issues/15">#15</a>)</li>
<li>See full diff in <a
href="f5814dcf37...d059ed7184">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.22&new-version=0.0.23)](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-19 18:48:30 -08:00
Mitchell Hashimoto
549824842d vt: add style and grapheme accessors
Add ghostty_grid_ref_style and ghostty_grid_ref_graphemes to the grid
ref C API, allowing callers to extract the full style and grapheme
cluster directly from a grid reference without manually resolving
the page internals.
2026-03-19 19:48:16 -07:00
Mitchell Hashimoto
df8813bf1b vt: replace ghostty_terminal_cell with GhosttyGridRef API 2026-03-19 19:40:53 -07:00
Jon Parise
2a952b4dfe bash: move __ghostty_preexec_hook into __ghostty_hook
We previously used a readonly variable (__ghostty_ps0) to define the
best __ghostty_preexec_hook expansion for the current bash version.

This works pretty well, but it had the downside of managing another
variable (#11258).

We can instead simplify this a bit by moving this into __ghostty_hook. I
didn't take that approach originally because I wanted to avoid the bash
version check on each command, but slightly loosening our guard check to
just look for "__ghostty_preexec_hook" (rather than the full expansion
expression) means we can bury the bash version check to the cold path.

One small gap here is that we may not update PS0 to the correct syntax
if we start switching between significantly different bash versions in
interactive subshells, but that seems like a pretty rare case to handle
given the benefits of this approach.
2026-03-19 20:59:16 -04:00
dependabot[bot]
7c14aecd3f 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.22 to 0.0.23.
- [Release notes](https://github.com/namespacelabs/nscloud-setup-buildx-action/releases)
- [Commits](f5814dcf37...d059ed7184)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-20 00:12:37 +00:00
dependabot[bot]
10e69384d7 build(deps): bump namespacelabs/nscloud-setup from 0.0.11 to 0.0.12
Bumps [namespacelabs/nscloud-setup](https://github.com/namespacelabs/nscloud-setup) from 0.0.11 to 0.0.12.
- [Release notes](https://github.com/namespacelabs/nscloud-setup/releases)
- [Commits](f378676225...df198f982f)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-20 00:12:29 +00:00
Mitchell Hashimoto
0400de28b4 vt: add ghostty_terminal_cell for point-based cell lookup
Add a new C API function ghostty_terminal_cell that retrieves the
opaque cell and row values at a given point in the terminal grid.
The point is a tagged union supporting active, viewport, screen, and
history coordinate systems.
2026-03-19 15:16:55 -07:00
Mitchell Hashimoto
057f227145 terminal: convert Point to lib.Enum/lib.TaggedUnion with C header 2026-03-19 14:01:11 -07:00
Mitchell Hashimoto
5c8b9f3f43 vt: add GhosttyCell and GhosttyRow C API with data getters
Add opaque GhosttyCell (uint64_t) and GhosttyRow (uint64_t) types that
bitcast to the internal packed Cell and Row structs from page.zig. Each
type has a corresponding data enum and getter function following the
same pattern as ghostty_terminal_get.

ghostty_cell_get supports extracting codepoint, content tag, wide
property, has_text, has_styling, style_id, has_hyperlink, protected,
and semantic_content. ghostty_row_get supports wrap, wrap_continuation,
grapheme, styled, hyperlink, semantic_prompt, kitty_virtual_placeholder,
and dirty.

The cell and row types and functions live in a new screen.h header,
separate from terminal.h, with terminal.h including screen.h for
convenience.
2026-03-19 13:15:45 -07:00
Mitchell Hashimoto
d827225573 vt: expand padding for color union to 64-bit to allow for a pointer 2026-03-19 12:24:34 -07:00
Mitchell Hashimoto
d62f6df1d5 vt: expose cursor_style via terminal_get
Add cursor_style to TerminalData, returning the current SGR style
of the cursor (the style applied to newly printed characters) as a
GhosttyStyle.

Refactor the C style conversion helpers: replace the standalone
convertStyle and convertColor functions with fromStyle and fromColor
initializers on the Style and Color extern structs respectively.
2026-03-19 12:08:31 -07:00
Mitchell Hashimoto
7f36e8bd43 vt: add style C API
Expose the terminal Style struct to the C API as GhosttyStyle, a
sized struct with foreground, background, and underline colors
(as tagged unions) plus boolean text decoration flags.

Add ghostty_style_default() to obtain the default style and
ghostty_style_is_default() to check whether a style has all
default values. Wire both through c/style.zig, main.zig, and
lib_vt.zig with the corresponding header in vt/style.h.
2026-03-19 12:02:03 -07:00
Mitchell Hashimoto
f168b3c098 vt: add ghostty_terminal_get for reading terminal state
Add a typed data query API to the terminal C interface, following
the same OutType pattern used by the OSC command data API. The new
ghostty_terminal_get function takes a GhosttyTerminalData tag and
an output pointer, returning GhosttyResult.

Currently exposes cols, rows, cursor x/y position, and cursor
pending wrap state. The GhosttyTerminalData enum is placed with the
other types in the header (before functions) per the ordering
convention.
2026-03-19 11:47:55 -07:00
Mitchell Hashimoto
c2e9de224e build(deps): bump cachix/cachix-action from 16 to 17 (#11643)
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action)
from 16 to 17.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cachix/cachix-action/releases">cachix/cachix-action's
releases</a>.</em></p>
<blockquote>
<h2>v17</h2>
<h2>What's Changed</h2>
<h3>Breaking changes</h3>
<ul>
<li>Upgrade action to use Node 24 by <a
href="https://github.com/sandydoo"><code>@​sandydoo</code></a> in <a
href="https://redirect.github.com/cachix/cachix-action/pull/212">cachix/cachix-action#212</a>
<a
href="https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/">https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/cachix/cachix-action/compare/v16...v17">https://github.com/cachix/cachix-action/compare/v16...v17</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1eb2ef646a"><code>1eb2ef6</code></a>
Merge pull request <a
href="https://redirect.github.com/cachix/cachix-action/issues/212">#212</a>
from cachix/upgrade-node-24</li>
<li><a
href="75ce400143"><code>75ce400</code></a>
dist: re-build using esbuild targeting node24</li>
<li><a
href="2b33705a82"><code>2b33705</code></a>
deps: update devenv inputs</li>
<li><a
href="04937db281"><code>04937db</code></a>
breaking: update action to Node 24</li>
<li><a
href="ca2e51995f"><code>ca2e519</code></a>
ci: use 25.11 for tests</li>
<li><a
href="e7c5c1add2"><code>e7c5c1a</code></a>
Merge pull request <a
href="https://redirect.github.com/cachix/cachix-action/issues/208">#208</a>
from cachix/dependabot/github_actions/actions/checkout-6</li>
<li><a
href="bea8a50645"><code>bea8a50</code></a>
ci: allow running tests manually and with a custom nix version</li>
<li><a
href="2e35755955"><code>2e35755</code></a>
chore(deps): bump actions/checkout from 5 to 6</li>
<li>See full diff in <a
href="3ba601ff5b...1eb2ef646a">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cachix/cachix-action&package-manager=github_actions&previous-version=16&new-version=17)](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-19 08:38:49 -07:00
Mitchell Hashimoto
2bbbca369d bash: emit 133;P (instead of 133;A) under ble.sh (#11644)
ble.sh performs its own cursor positioning so we get multiple newlines
with 133;A's fresh-line behavior. ble.sh is a large enough project to
justify this additional, unambiguous conditional.

See: akinomyoga/ble.sh#684
See: wezterm/wezterm#5072
2026-03-19 08:38:24 -07:00
Jon Parise
b1ad24e24f bash: emit 133;P (instead of 133;A) under ble.sh
ble.sh performs its own cursor positioning so we get multiple newlines
with 133;A's fresh-line behavior. ble.sh is a large enough project to
justify this additional, unambiguous conditional.

See: akinomyoga/ble.sh#684
See: wezterm/wezterm#5072
2026-03-19 11:26:52 -04:00
Jeffrey C. Ollie
69e0673478 ci: use local git commands for path-filter action (#11652)
Passing a `token` value causes this action to use the GitHub REST API,
which is subject to rate limits. We can chew through that allowance
quickly (1,000 requests/hour) given that we run two of these actions per
workflow run.

`token` defaults to the workflow's token, but by setting it explicitly
to an empty string, the action will instead use `git diff` to determine
the modified paths. This works fine for our case because we're already
running the checkout action, so we have an up-to-date repository view.

This also has the advantage of working around the 300 files GitHub REST
API limit for listing changed files.

Ref: https://github.com/dorny/paths-filter
2026-03-19 04:19:47 -08:00
Jon Parise
c9729fbd26 ci: use local git commands for path-filter action
Passing a `token` value causes this action to use the GitHub REST API,
which is subject to rate limits. We can chew through that allowance
quickly (1,000 requests/hour) given that we run two of these actions per
workflow run.

`token` defaults to the workflow's token, but by setting it explicitly
to an empty string, the action will instead use `git diff` to determine
the modified paths. This works fine for our case because we're already
running the checkout action, so we have an up-to-date repository view.

This also has the advantage of working around the 300 files GitHub REST
API limit for listing changed files.

Ref: https://github.com/dorny/paths-filter
2026-03-19 08:06:34 -04:00
dependabot[bot]
c08a21180a build(deps): bump cachix/cachix-action from 16 to 17
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 16 to 17.
- [Release notes](https://github.com/cachix/cachix-action/releases)
- [Commits](3ba601ff5b...1eb2ef646a)

---
updated-dependencies:
- dependency-name: cachix/cachix-action
  dependency-version: '17'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-19 00:13:01 +00:00
Jeffrey C. Ollie
c9e1006213 Fix: correct "Open Ghostty Here" Dolphin action for Plasma (#11614)
See #11594

The change allows "Open Ghostty Here" Dolphin action to launch new
ghostty window with gtk single instance.
2026-03-18 11:49:10 -05:00
Mitchell Hashimoto
3dc69981d2 bash: handle PROMPT_COMMAND ending in a newline (#11621)
We need to handle on more case: when an existing PROMPT_COMMAND ends in
a newline, we don't want to append a ; because that already counts as a
command separator.

We now handle all of these PROMPT_COMMAND cases:

- Ends with ; — no ; added
- Ends with \n or other whitespace — no ; added
- Ends with a command name — ; added as separator

See: #11245
2026-03-18 09:10:20 -07:00