[PR #86] [CLOSED] Migrate to zig 0.15.1 #1057

Closed
opened 2026-03-14 09:16:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/86
Author: @nyxkrage
Created: 8/26/2025
Status: Closed

Base: mainHead: migrate-zig-0.15.1


📝 Commits (1)

  • 28cab43 feat: migrate to zig 0.15.1

📊 Changes

6 files changed (+112 additions, -99 deletions)

View changed files

📝 packages/core/scripts/build.ts (+3 -1)
📝 packages/core/src/zig/ansi.zig (+5 -5)
📝 packages/core/src/zig/buffer.zig (+1 -1)
📝 packages/core/src/zig/build.zig (+1 -3)
📝 packages/core/src/zig/renderer.zig (+87 -74)
📝 packages/core/src/zig/text-buffer.zig (+15 -15)

📄 Description

Fixes #12

Also includes a small change to the build script which allows setting the Zig compiler with the ZIG environment variable, as this makes it much easier than needing to change your PATH back and forth when testing different versions of zig.

Migrates:
std.fmt.format -> std.Io.Writer.print
std.ArrayList -> std.ArrayListUnmanaged (while std.array_list.Managed does exist and should be the same as the old ArrayList, the managed options will be removed in the future, so I thought might as well bite the bullet and use the Unmanaged versions as is recommended)
CliRenderer.addStatSample to a method instead of a function so that it can use self.allocator for the unmanaged arraylist it now uses
Removes the use of bufferedWriter and now just stores the buffer and constructs the stdout writer as needed.

One consideration is the use of the std.io.GenericWriter in the CliRenderer.writer return type, this is technically deprecated, but as far as I can tell, the other options requires a much larger refactoring, so I have marked it as a TODO, however you may want to just hold out on moving to Zig 0.15 and migrate it properly at the same time as upgrading the toolchain version instead.

With these changes I also seem to get faster speeds from the src/benchmark/renderer-benchmark.ts, though unsure why that is or whether it is a fluke.
Before:
image
After:
image


🔄 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/86 **Author:** [@nyxkrage](https://github.com/nyxkrage) **Created:** 8/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `migrate-zig-0.15.1` --- ### 📝 Commits (1) - [`28cab43`](https://github.com/anomalyco/opentui/commit/28cab43ce9bc435c6e4edfaa21c73527af1bc791) feat: migrate to zig 0.15.1 ### 📊 Changes **6 files changed** (+112 additions, -99 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/scripts/build.ts` (+3 -1) 📝 `packages/core/src/zig/ansi.zig` (+5 -5) 📝 `packages/core/src/zig/buffer.zig` (+1 -1) 📝 `packages/core/src/zig/build.zig` (+1 -3) 📝 `packages/core/src/zig/renderer.zig` (+87 -74) 📝 `packages/core/src/zig/text-buffer.zig` (+15 -15) </details> ### 📄 Description Fixes #12 Also includes a small change to the build script which allows setting the Zig compiler with the ZIG environment variable, as this makes it much easier than needing to change your PATH back and forth when testing different versions of zig. Migrates: std.fmt.format -> std.Io.Writer.print std.ArrayList -> std.ArrayListUnmanaged (while std.array_list.Managed does exist and should be the same as the old ArrayList, the managed options will be removed in the future, so I thought might as well bite the bullet and use the Unmanaged versions as is recommended) CliRenderer.addStatSample to a method instead of a function so that it can use self.allocator for the unmanaged arraylist it now uses Removes the use of bufferedWriter and now just stores the buffer and constructs the stdout writer as needed. One consideration is the use of the std.io.GenericWriter in the CliRenderer.writer return type, this is technically deprecated, but as far as I can tell, the other options requires a much larger refactoring, so I have marked it as a TODO, however you may want to just hold out on moving to Zig 0.15 and migrate it properly at the same time as upgrading the toolchain version instead. With these changes I also seem to get faster speeds from the src/benchmark/renderer-benchmark.ts, though unsure why that is or whether it is a fluke. Before: <img width="418" height="316" alt="image" src="https://github.com/user-attachments/assets/b42962e4-6738-4b57-b347-e3ec43b2f2a4" /> After: <img width="418" height="316" alt="image" src="https://github.com/user-attachments/assets/887e0a31-d5f6-467d-b627-fa41682f27c2" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:16:11 +03:00
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#1057
No description provided.