Skip to content

Replace truncation probe with trimmedFront delta arithmetic #161

@spamsch

Description

@spamsch

Currently, TerminalViewport uses a 32-char probe heuristic to find the overlap between the trimmed rawOutput buffer and the live xterm state, then replays only the new tail. This works for most output but has a known failure mode: if the probe matches the wrong repeated region, the delta arithmetic is wrong, lastRawOutputRef advances past the true match, and content is silently dropped from xterm.

The right fix is to surface trimmedFront from appendTerminalRawOutput — the exact byte count removed on each cap-trim. With that value, the replay offset is arithmetic (rawOutput.length - trimmedFront) rather than a string search, and the heuristic can be removed entirely.

Tracked from: #156

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions