[PR #440] Add StatelessTerminal renderable. Render ANSI as opentui styled text #1321

Open
opened 2026-03-14 09:30:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/440
Author: @remorses
Created: 12/23/2025
Status: 🔄 Open

Base: mainHead: ghostty-opentui-2


📝 Commits (10+)

  • 4a41113 upgrade to zig 0.15.2 with ghostty-vt dependency
  • be69a9b fix(ci): update zig to 0.15.2 and skip macOS cross-compilation from Linux
  • 1fe9c14 fix: add macOS SDK for cross-compilation from Linux
  • 59b5391 fix: add explicit refs to git URLs in build.zig.zon
  • 7e8a205 fix: correct hash for macos_sdk dependency
  • 08a4dad fix: use raw macOS SDK tarball instead of outdated zig package
  • 920c5d4 fix(ci): only build lib, not native binaries for all platforms
  • d7e55c5 fix(ci): use macos-latest runners for cross-compilation
  • 7492abd fix: build only native platform by default, add --all for all platforms
  • bac4cd3 fix: remove reference to non-existent ghostty-terminal.zig test file

📊 Changes

20 files changed (+1326 additions, -38 deletions)

View changed files

📝 .github/workflows/build-examples.yml (+1 -1)
📝 packages/core/package.json (+2 -0)
📝 packages/core/scripts/build.ts (+38 -30)
packages/core/src/examples/terminal-simple-demo.ts (+162 -0)
📝 packages/core/src/lib/index.ts (+1 -0)
packages/core/src/lib/vterm-ffi.ts (+80 -0)
packages/core/src/renderables/Terminal.test.ts (+254 -0)
packages/core/src/renderables/Terminal.ts (+144 -0)
📝 packages/core/src/renderables/index.ts (+1 -0)
📝 packages/core/src/renderer.ts (+1 -1)
📝 packages/core/src/tests/wrap-resize-perf.test.ts (+1 -1)
📝 packages/core/src/zig.ts (+152 -2)
📝 packages/core/src/zig/build.zig (+9 -2)
📝 packages/core/src/zig/build.zig.zon (+4 -0)
📝 packages/core/src/zig/lib.zig (+63 -0)
📝 packages/core/src/zig/renderer.zig (+2 -1)
packages/core/src/zig/vterm.zig (+403 -0)
📝 packages/react/src/components/index.ts (+2 -0)
📝 packages/react/src/types/components.ts (+4 -0)
📝 packages/solid/src/elements/index.ts (+2 -0)

📄 Description

Stacked on #439 (zig 0.15 upgrade).

Adds terminal rendering support using ghostty-vt:

  • StatelessTerminalRenderable - fast renderer for first few lines of output (renders in ~ms, for opencode bash previews)

The terminal output is renderd line by line instead of using character cells. This should make it pretty fast even for super long ANSI outputs if they don't use many colors. Each line will simply be a line of text in opentui.

Includes VTerm FFI bindings and registration in React, Solid, and Vue.

Here is how bash outputs looks like in opencode using these terminal renderables (only stateless for now):

https://github.com/user-attachments/assets/f5c072be-8ffd-4ab4-8149-114ddc7db2fb


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/440 **Author:** [@remorses](https://github.com/remorses) **Created:** 12/23/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ghostty-opentui-2` --- ### 📝 Commits (10+) - [`4a41113`](https://github.com/anomalyco/opentui/commit/4a411135ba3d03681b449b57226b01623f8e585c) upgrade to zig 0.15.2 with ghostty-vt dependency - [`be69a9b`](https://github.com/anomalyco/opentui/commit/be69a9b7483f78adaee1fab801f2bf5324b08388) fix(ci): update zig to 0.15.2 and skip macOS cross-compilation from Linux - [`1fe9c14`](https://github.com/anomalyco/opentui/commit/1fe9c1413ec80c60f0fbfac5eeff80ee439cebaf) fix: add macOS SDK for cross-compilation from Linux - [`59b5391`](https://github.com/anomalyco/opentui/commit/59b539143dd961168958607ac2673d77cb1bbb74) fix: add explicit refs to git URLs in build.zig.zon - [`7e8a205`](https://github.com/anomalyco/opentui/commit/7e8a205b9a2258246d651aa48dc40ad742e340e1) fix: correct hash for macos_sdk dependency - [`08a4dad`](https://github.com/anomalyco/opentui/commit/08a4dadbe27a5c5a09687d967e2c81ea6c329db9) fix: use raw macOS SDK tarball instead of outdated zig package - [`920c5d4`](https://github.com/anomalyco/opentui/commit/920c5d459644c1907b30a564dc6b53e472d1ac86) fix(ci): only build lib, not native binaries for all platforms - [`d7e55c5`](https://github.com/anomalyco/opentui/commit/d7e55c5f238a8e27e6081ceb8425a47b964e602d) fix(ci): use macos-latest runners for cross-compilation - [`7492abd`](https://github.com/anomalyco/opentui/commit/7492abd9f71c11d337754727005d9f55ec5b6903) fix: build only native platform by default, add --all for all platforms - [`bac4cd3`](https://github.com/anomalyco/opentui/commit/bac4cd341512aef5b0972a098b2540ce697d2bde) fix: remove reference to non-existent ghostty-terminal.zig test file ### 📊 Changes **20 files changed** (+1326 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build-examples.yml` (+1 -1) 📝 `packages/core/package.json` (+2 -0) 📝 `packages/core/scripts/build.ts` (+38 -30) ➕ `packages/core/src/examples/terminal-simple-demo.ts` (+162 -0) 📝 `packages/core/src/lib/index.ts` (+1 -0) ➕ `packages/core/src/lib/vterm-ffi.ts` (+80 -0) ➕ `packages/core/src/renderables/Terminal.test.ts` (+254 -0) ➕ `packages/core/src/renderables/Terminal.ts` (+144 -0) 📝 `packages/core/src/renderables/index.ts` (+1 -0) 📝 `packages/core/src/renderer.ts` (+1 -1) 📝 `packages/core/src/tests/wrap-resize-perf.test.ts` (+1 -1) 📝 `packages/core/src/zig.ts` (+152 -2) 📝 `packages/core/src/zig/build.zig` (+9 -2) 📝 `packages/core/src/zig/build.zig.zon` (+4 -0) 📝 `packages/core/src/zig/lib.zig` (+63 -0) 📝 `packages/core/src/zig/renderer.zig` (+2 -1) ➕ `packages/core/src/zig/vterm.zig` (+403 -0) 📝 `packages/react/src/components/index.ts` (+2 -0) 📝 `packages/react/src/types/components.ts` (+4 -0) 📝 `packages/solid/src/elements/index.ts` (+2 -0) </details> ### 📄 Description Stacked on #439 (zig 0.15 upgrade). Adds terminal rendering support using ghostty-vt: - `StatelessTerminalRenderable` - fast renderer for first few lines of output (renders in ~ms, for opencode bash previews) The terminal output is renderd line by line instead of using character cells. This should make it pretty fast even for super long ANSI outputs if they don't use many colors. Each line will simply be a line of text in opentui. Includes VTerm FFI bindings and registration in React, Solid, and Vue. Here is how bash outputs looks like in opencode using these terminal renderables (only stateless for now): https://github.com/user-attachments/assets/f5c072be-8ffd-4ab4-8149-114ddc7db2fb --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1321
No description provided.