Skip to content

fix: keep a dor picker paste and cut-off key sequence across stdin reads - #1954

Merged
nedtwigg merged 2 commits into
mainfrom
fix/issue-1952
Nov 30, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
fix/issue-1952

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

dor open and dor tool's picker parsed each stdin read with no memory of the previous one, so a bracketed paste longer than one read left its paste mode after the first read: a newline in a later read became Enter and accepted the selected row. In the same way, an escape sequence cut at a read's end became Escape and closed the picker. openPickerScreen now keeps one keyParser() per screen. The parser stays inside a paste until ESC[201~ arrives, holding back a partial end marker, and it keeps an unfinished ESC [ … or ESC O for the next read. A lone ESC that ends a read is still Escape. parseKeys(chunk) stays as the one-read form.

Before the fix, parseKeys on the reads ESC[200~one\n, two\nthree, ESC[201~ returned enter in the second read. The new keyParser test in dor/test/open-picker.test.mjs feeds a paste and cut-off sequences across reads, and the dor picker tests pass.

One behavior change: an Alt+[ or Alt+O that arrives alone in a read is now held until the next read joins it, where before it was dropped right away. A following key can then complete it as a sequence, which is dropped if unknown.

Closes #1952 — automated triage

The picker parsed each stdin read on its own, so a bracketed paste longer
than one read had its later newlines read as Enter, accepting the selected
row, and an escape sequence cut at a read's end read as Escape. The parser
now lives per picker screen, stays inside a paste until its end marker, and
holds an unfinished sequence for the next read; a lone ESC ending a read is
still Escape.

Closes #1952
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9dd4c9d
Status: ✅  Deploy successful!
Preview URL: https://e1c108da.mouseterm.pages.dev
Branch Preview URL: https://fix-issue-1952.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The held-sequence check isn't anchored at the start, so it can hold back keys that were already complete. I'll push the fix with a test case.

Comment thread dor/src/commands/picker-core.ts Resolved
@nedtwigg
nedtwigg merged commit d13a1b2 into main Nov 30, 2026
13 checks passed
@nedtwigg
nedtwigg deleted the fix/issue-1952 branch November 30, 2026 23:41
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.

dor picker: a bracketed paste split across stdin reads can accept the selection

2 participants