feat(loop,layout): add engine loop, 1D flexbox, MIT licence - #3
Merged
Conversation
Add core/loop package: frame scheduler, event demultiplexer, typed event channels (Key, Mouse, Resize, Errors). Three goroutines (I/O, scheduler, frame) with Stop/Flush contract. Steady-state Flush performs 0 allocations. Add layout package: 1D flexbox engine per ADR-0001. Three-phase distribution (Basis -> Grow/Shrink -> layout), two directions (Row, Column). Verified 0 B/op, 0 allocs/op for 19-rect tree and 606-rect deep tree. Add LICENSE.md (MIT) at repo root with Russian and Chinese mirrors under docs/ru/ and docs/zh/. Add ADRs: - 0003 engine loop architecture - 0004 MIT licence selection - 0005 layout implementation Update CHANGELOG to v0.2.0, ARCHITECTURE modules section, and README licence pointers across all three languages.
Replace single-case select with channel receive and remove the unused waitForWrites helper.
Add Buffer.Clone() returning a deep copy with its own Cells slice. Mutating either buffer must not affect the other. Add TestNewBuffer_Dimensions and TestBufferClone_DeepCopy to guard the NewBuffer/Cells invariants the renderer relies on. Fixes the buffer_test.go corruption introduced by an earlier patch and the missing assertion for nil Cells.
- remove duplicate NewBuffer in core/buffer/buffer.go (unparam) - rewrite last-child residual adjustment as switch to drop nested if-else (revive: indent-error-flow) - iterate children by index range with int32 cast to silence rangeintconstant in TestRow_GrowEqual (revive) All packages: go vet clean, go test -race ./... pass, golangci-lint run ./... clean.
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.
Adds three new packages and an explicit licence for v0.2.0.
core/loop
Frame scheduler and event demultiplexer. Three goroutines (I/O,
scheduler, frame) with a typed channel surface (KeyEvents,
MouseEvents, ResizeEvents, Errors). Steady-state Flush performs
0 allocations; verified by go test -bench=. -benchmem.
layout
1D flexbox layout engine per ADR-0001. Three-phase distribution
(Basis -> Grow/Shrink -> layout) with two directions (Row,
Column). Verified 0 B/op, 0 allocs/op for a 19-rect tree and a
606-rect deep tree.
MIT Licence
LICENSE.md at the repo root with Russian and Chinese mirrors
under docs/ru/ and docs/zh/. See ADR-0004 for the selection.
Docs
Notes
platform layer; tracked as a follow-up.
Test plan