Skip to content

feat!: make term updates return void - #166

Merged
cowboyd merged 1 commit into
mainfrom
feat/state-only-update
Dec 1, 2026
Merged

cowboyd merged 1 commit into
mainfrom
feat/state-only-update

Conversation

@cowboyd

@cowboyd cowboyd commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

why?

the replay cache work involves splitting the state into "previous" and "last" frames, which means that rendering transactions should be clearly defined, and only happen via a single mechanism. The "mini-frame" made it unclear where what is actually the last pointer.

This feels better not only internally, but externally as well since the driver does not need to concern itself with output after a call to term.update()

term.update() previously returned terminal bytes, giving hosts a second output path alongside render(). It now returns void and applies dimension and capability changes synchronously. Hosts invoke render() to display the resulting state; multiple updates accumulate in call order for that render. The examples now follow this pattern, including rendering after capability changes in 2048.

Disabling pointer shape support suppresses all OSC 22 output and preserves the last emitted shape. Re-enabling support compares against that remembered shape. To reset the pointer to default, render without a pointer while support is enabled.

Stacked on #164, now based on main after #162 merged. This implements the reviewed update(): void spec as groundwork for frame ownership and replay; no separate issue is needed.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (deno task test: 29 suites, 389 steps)
  • Files are formatted (deno task fmt)
  • I have added/updated tests for my changes
  • I have added a changeset

Also verified the WASM build, deno task verify, deno lint, example type checks, and git diff --check after rebasing onto main.

AI-generated code disclosure

  • This PR includes AI-generated code

@bombshell-cooper

bombshell-cooper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Changeset suggestion

The current changeset no longer matches this PR. This review contains a corrected replacement.

Why: Changeset should start with an approved active present-tense verb. Changeset package scope does not match the affected packages confidently. Changeset bump does not match the consumer-visible impact.

View the proposed changeset
---
'@bomb.sh/tty': minor
---

Changes `term.update(events)` to return `void` instead of `Uint8Array`.

Dimension and capability changes still apply synchronously; call `term.render()` and write its `output` to reflect them. Multiple `update()` calls before the next render accumulate in call order.

Disabling pointer-shape support no longer resets the terminal's pointer shape. While the capability is `false`, renders emit no shape changes. When re-enabled, the next render compares against the last emitted shape as usual. To reset the pointer to `default`, render without a `pointer` option while the capability is `true` and write the result's `output`.

#### Migration

```diff
-let output = term.update(events);
-if (output.length) stdout.write(output);
+term.update(events);
+let { output } = term.render(ops);
+stdout.write(output);
```

Review this changeset manually

If this draft is correct, react with 🚀 and Cooper will commit it to this branch.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@bomb.sh/tty@166

commit: b6e8713

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Size Reduced — -1.2 KB

131.2 KB unpacked

@cowboyd
cowboyd force-pushed the feat/state-only-update branch from ba2d1bd to c791853 Compare December 1, 2026 02:23
@@ -0,0 +1,8 @@
---

@bombshell-cooper bombshell-cooper Bot Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changeset needs revision.

Changeset should start with an approved active present-tense verb. Changeset package scope does not match the affected packages confidently. Changeset bump does not match the consumer-visible impact.

View the proposed replacement
---
'@bomb.sh/tty': minor
---

Changes `term.update(events)` to return `void` instead of `Uint8Array`.

Dimension and capability changes still apply synchronously; call `term.render()` and write its `output` to reflect them. Multiple `update()` calls before the next render accumulate in call order.

Disabling pointer-shape support no longer resets the terminal's pointer shape. While the capability is `false`, renders emit no shape changes. When re-enabled, the next render compares against the last emitted shape as usual. To reset the pointer to `default`, render without a `pointer` option while the capability is `true` and write the result's `output`.

#### Migration

```diff
-let output = term.update(events);
-if (output.length) stdout.write(output);
+term.update(events);
+let { output } = term.render(ops);
+stdout.write(output);
```

Base automatically changed from refactor/native-renderer-lifecycle to main December 1, 2026 02:30
@cowboyd
cowboyd force-pushed the feat/state-only-update branch from c791853 to 74b02ce Compare December 1, 2026 02:30
@cowboyd
cowboyd force-pushed the feat/state-only-update branch from 74b02ce to b6e8713 Compare December 1, 2026 02:34
@cowboyd
cowboyd merged commit 5c61c14 into main Dec 1, 2026
12 checks passed
@cowboyd
cowboyd deleted the feat/state-only-update branch December 1, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants