Fix life.occ display buffering and ALT busy-wait#92
Merged
associate-1 merged 1 commit intomainfrom Feb 24, 2026
Merged
Conversation
Two bugs prevented the Game of Life editor mode from working: 1. Screen output goroutine never flushed for small writes. Add auto-flush when the channel drains (len(ch) == 0), so bursts of output flush immediately while still batching rapid writes. 2. Guarded SKIP in ALT generated unconditional `default:` in select, causing 100% CPU spin when the guard was false. Use a dual-select pattern: when guard is true, include default (non-blocking); when false, omit default (blocks on channels). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dboreham
approved these changes
Feb 24, 2026
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.
Summary
Fixes the two bugs preventing the Game of Life editor mode from working (#72):
len(ch) == 0, so small writes (cursor movements, single characters) appear immediately instead of waiting for the 4096-byte buffer to fillselectomitsdefault:so it blocks on channel cases instead of busy-waiting at 100% CPUTest plan
go test ./...)TestE2E_AltGuardedSkipFalseBlockingverifies ALT blocks when SKIP guard is false (uses relay channel to force sender delay)life.occtranspiles and passesgo vetgo run /tmp/life.go— e→arrows→*→q→r works🤖 Generated with Claude Code