Release held modifiers before synthesizing the paste - #18
Merged
Merged
Conversation
Unspooling advanced the spool and never pasted. The cause is that a hotkey fires on the key down, so when the handler runs the user is still holding Win+Alt. Synthesizing Ctrl+V into that state delivers Win+Alt+Ctrl+V, which is a paste in no application, and nothing happens. It looked intermittent because a handler that happened to run after the keys came up worked fine, which is how it got through a round of testing with a false pass. The addon now lifts every modifier that is currently down before pressing Ctrl+V. They are not restored: the user's keys are still physically held, their release is harmless, and re-pressing Win would open the Start menu. Verified by holding the modifiers 700ms past the hotkey, which is what a person actually does — three unspools in a row now deliver three clips in order. Two things follow from the report rather than from the code. Pasting the whole spool now pastes as well, because one key that pastes and one that silently changes the clipboard is an inconsistency rather than a design; the setting is renamed autoPaste to cover both, still reading the old pasteOnServe key. And a paste that does not land now says so and names Ctrl+V as the way out — Windows refuses synthesized input to elevated windows and some terminals want Ctrl+Shift+V, and in those cases silence is what makes a user conclude the app is broken. Unspooling while Spool's own window is in front now dismisses it and pastes into whatever was behind, rather than refusing in silence. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Unspooling advanced the spool and never pasted. This is why, and the fix.
The cause
A hotkey fires on the key down. So at the instant Spool's handler runs, the user is still holding
Win+Alt— they have not let go ofWin+Alt+Uyet. SynthesizingCtrl+Vinto that state deliversWin+Alt+Ctrl+V, which is a paste in no application on earth, so nothing happens.It looked intermittent because a handler that happened to run after the keys came up worked perfectly. That is how it passed a round of testing: my own verification pressed the keys with a 60ms hold, short enough that the modifiers were often already up by the time the paste fired. A person holds them far longer.
The fix
The addon lifts every modifier currently down before pressing
Ctrl+V:They are not restored afterwards. The user's own keys are still physically held, so their next release is harmless — whereas re-pressing
Winhere would open the Start menu.Verified by holding the modifiers 700ms past the hotkey, which is what a person actually does. Three unspools in a row now deliver three clips in order, and paste-all delivers the joined spool.
Two things that follow from the report rather than the code
Pasting the whole spool now pastes. One key that pastes and one that silently changes the clipboard is an inconsistency, not a design —
Win+Alt+Vlooked completely dead from the user's seat. The setting is renamedautoPasteto cover both placements, and still reads a settings file written under the oldpasteOnServename.A paste that does not land says so, naming
Ctrl+Vas the way out. Windows refuses synthesized input to windows running as administrator, and some terminals paste withCtrl+Shift+V. In those cases silence is exactly what makes a user conclude the app is broken, which is what happened here.Unspooling while Spool's own window is in front now dismisses the window and pastes into whatever was behind it, rather than refusing in silence. A global hotkey does not steal focus, so this only arises when the user summoned Spool and has not clicked away — and then the only sensible target is what they were in before.
Verification
395 tests, typecheck, lint, and the zero-network gate pass. The two new tests cover the case that was silently wrong: a paste that fails must produce a notice, and one that succeeds must not.
Still to confirm: the same flow in the installed MSIX against a real editor, which is the configuration that originally failed.
Note
Conflicts with #17 are likely — both touch
session.ts. Merge order is whichever you prefer; I will rebase the other.🤖 Generated with Claude Code