fix(ui): enable paste on initial PAT token prompt#152
Merged
mpkrass7 merged 1 commit intoApr 30, 2026
Merged
Conversation
Two issues prevented paste from working on the first-run PAT prompt: 1. Terminal had no focus when the prompt rendered, so xterm's helper textarea never received the browser paste event. Added term.focus() right after writing the Token: prompt. 2. The document-level capture-phase paste listener short-circuited on !sessionId for ALL paste types, dropping text paste before xterm could see it. Restricted that early-exit to image paste only; text paste now falls through to xterm regardless of session state. Also made the masking handler tolerate multi-character chunks (pasted strings) and auto-submit on a trailing newline. Co-authored-by: Isaac
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
On the first-run flow, the terminal prompts the user to paste a short-lived PAT (
static/index.html:1492). In practice, paste did nothing — users had to type the token by hand. Two issues combined to cause this:term.focus(), focus sat on<body>and xterm's helper textarea never received the paste event.!sessionIdfor ALL paste types. Sincepane.sessionIdis only set aftergetOrPromptSessionruns (post-auth), the capture-phase listener atstatic/index.html:2029consumed and dropped text paste during the PAT prompt — even with the xterm textarea focused.The masking input handler also wrote a single
*for any pasted multi-character chunk, which looked broken.Changes (
static/index.html)term.focus()immediately after theToken:prompt write so xterm owns focus beforeterm.onDatais wired up.*per printable char) and auto-submit when a paste ends in\r/\n.No backend changes. No new dependencies.
Test plan
/api/upload.Why it never repro'd in CI
There is no test harness for
static/index.html, and the PAT prompt only fires when/api/pat-statusreturns invalid — a state that's already configured-away in most local dev setups.This pull request and its description were written by Isaac.