From 06d025b35da2f1dca0c545712c16916842edcbba Mon Sep 17 00:00:00 2001 From: minh Date: Fri, 12 Dec 2025 12:50:48 -0800 Subject: [PATCH] check for bracketed paste in input handler --- lib/input-handler.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/input-handler.ts b/lib/input-handler.ts index 6e3bd5f..d5bf827 100644 --- a/lib/input-handler.ts +++ b/lib/input-handler.ts @@ -506,10 +506,16 @@ export class InputHandler { return; } - // Send the text to the terminal - // Note: For bracketed paste mode, we would wrap this in \x1b[200~ ... \x1b[201~ - // but for now, send raw text - this.onDataCallback(text); + // Check if bracketed paste mode is enabled (DEC mode 2004) + const hasBracketedPaste = this.getModeCallback?.(2004) ?? false; + + if (hasBracketedPaste) { + // Wrap with bracketed paste sequences + this.onDataCallback('\x1b[200~' + text + '\x1b[201~'); + } else { + // Send raw text + this.onDataCallback(text); + } } /**