Merge PR #6201: fix(auth): route smart paste into focused prompts (@roboomp)

This commit is contained in:
can1357
2026-07-22 21:13:19 +02:00
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.