Fix/writergate#97
Merged
meszmate merged 4 commits intomeszmate:mainfrom Apr 26, 2026
Merged
Conversation
Two small follow-ups while reviewing the writer migration: 1. Both Writer.drain implementations (terminal.zig and wasm.zig) indexed data[data.len - 1] without first checking data.len > 0. The std.Io contract treats an empty data slice as a pure flush; if the runtime ever calls drain with no fragments the old code would panic. Add an early-return. 2. Style.render unconditionally initialized a second Writer.Allocating for tab expansion even when tab_width was null. Move the buf declaration inside the if-block so it's only paid for when actually used. (No correctness impact — Allocating starts empty so the deinit was a no-op — but it removes a per-render allocation noise.) Build and full test suite still green; smoke-tested counter, showcase, form, action_system, rich_log, braille_canvas — no regressions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaced all deprecated
GenericWriters withstd.Io.Writer.zig build testpasses.zig build run-counterbuilds and runs.As big as this is the only two real changes are the Writers in Terminal and wasm, and I would take a good look at those to see if I missed something. Note that I haven't created a way to verify the wasm version yet.
For reference:
is the closest replacement for
for fixed writer