Repository navigation
Conversation
The renderer kept the model's *Cursor in the last rendered view, so a cursor changed in place compared equal to itself and flush skipped the frame. Copy the cursor in render so each frame keeps its own position.
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.
CONTRIBUTING.md.Fixes #1784
The bug
renderstored the model's*Cursoras is, andflushkept that view aslastView. When a model moves the cursor it already passed in,viewEqualscompares the cursor with itself, so with unchanged content the frame is skipped and the terminal cursor stays where it was. Because the renderer reads that cursor from its own goroutine,-racealso reports a data race betweenUpdateandviewEquals.Fix
Copy the cursor in
renderso each frame keeps its own position.Testing
TestCursedRenderer_movesCursorChangedInPlace. It fails on main, passes with the fix, and checks that the next unchanged frame writes nothing.m.cursor.X++over static text left the cursor at column 0 on main and now moves it one column per key press. A new cursor per frame writes the same bytes as before.go test -race -count 4 -cpu 1,4 ./...,go vet ./...and golangci-lint v2.9 pass.