fix(auth): routed smart paste into focused prompts

- Intercepted the configured smart-paste shortcut while a paste-capable modal owns focus.
- Added regression coverage for Ctrl+V API-key entry and documented the fix.

Fixes #6057
This commit is contained in:
roboomp
2026-07-21 20:33:16 +00:00
parent 9fd6e97113
commit 0d8a9d2f07
3 changed files with 41 additions and 1 deletions
@@ -172,6 +172,7 @@ export class InputController {
#enhancedPaste?: EnhancedPasteController;
#focusedLeftTapListenerInstalled = false;
#focusedPasteListenerInstalled = false;
#btwBranchListenerInstalled = false;
#btwCopyListenerInstalled = false;
// Tap counter for the double-← gesture; reset whenever a quiet gap
@@ -265,6 +266,16 @@ export class InputController {
return { consume: true };
});
}
if (!this.#focusedPasteListenerInstalled) {
this.#focusedPasteListenerInstalled = true;
this.ctx.ui.addInputListener(data => {
const focused = this.ctx.ui.getFocused();
if (!focused || focused === this.ctx.editor || !hasPasteText(focused)) return undefined;
if (!this.ctx.keybindings.matches(data, "app.clipboard.pasteImage")) return undefined;
void this.handleImagePaste();
return { consume: true };
});
}
this.ctx.editor.onEscape = () => {
// Side-channel panels are the topmost view. Esc dismisses them before
// touching loop mode, maintenance, or the underlying main turn.