vt: preserve semantic wraps across resize and reattach#919
Draft
takezoh wants to merge 2 commits into
Draft
Conversation
Keep cells and row boundaries behind one mutation owner so erase, scroll, resize, and snapshot cannot observe stale parallel provenance. Separate alternate physical resize from primary reflow and make snapshots atomic and fallible.
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
Preserve terminal soft-wrap boundaries in the VT screen and scrollback model, then use them to reflow retained content across resizes and reattachments.
Why
Physical terminal rows are not semantic lines. Once soft-wrap provenance is discarded, a narrow terminal snapshot cannot be reconstructed correctly when a wider client attaches: retained output stays permanently wrapped at the old width.
Changes
Emulator.ReattachSnapshotso reattachment emits hard boundaries as CRLF while leaving soft-wrap continuations unbrokenImpact
Consumers can rebuild a terminal for a new viewport without baking the previous client's width into retained history. Existing
Scrollback.LineandScrollback.Linesaccessors remain available.Checks
go test ./...invt/go test -race ./...invt/go vet ./...invt/