Skip to content

Preserve selections while older scrollback is trimmed - #1281

Merged
nedtwigg merged 3 commits into
audit-copy-selection-identityfrom
audit-selection-scrollback
Oct 21, 2026
Merged

nedtwigg merged 3 commits into
audit-copy-selection-identityfrom
audit-selection-scrollback

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

At the scrollback limit, new output shifts surviving rows toward the start of the buffer. Selection coordinates stayed at the old rows, so still-present text lost its selection. If a trimmed row was replaced by identical text, the opposite happened: a selection survived after its original row was gone.

Follow a marker on the selection's earlier row before comparing its text. Keep the copy editor and any program-provided copy offer while the same cells move; cancel when the selected row is trimmed. This covers linewise, block, and program-owned selections without text searching.

Validation: four real-xterm regressions fail before the fix. All 157 affected selection, reflow, lifecycle, copy editor, overlay, and mouse-router tests pass. Library TypeScript, spec lint, Markdown lint, and diff checks pass.

Stacked on #1280 because both fixes preserve selection state through coordinate changes. Their shared replacement logic is integrated here.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: c397727
Status: ✅  Deploy successful!
Preview URL: https://cf222901.mouseterm.pages.dev
Branch Preview URL: https://audit-selection-scrollback.mouseterm.pages.dev

View logs

…ollback

# Conflicts:
#	lib/src/lib/mouse-selection.ts
@nedtwigg
nedtwigg changed the base branch from main to audit-copy-selection-identity October 21, 2026 07:52
@nedtwigg
nedtwigg added this pull request to stack #1322 October 21, 2026 15:46
@nedtwigg
nedtwigg merged commit 161d52b into main Oct 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants