Skip to content

Commit 65aeac9

Browse files
authored
fix: check for bracketed paste in input handler (#99)
1 parent 9e4e126 commit 65aeac9

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

lib/input-handler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,16 @@ export class InputHandler {
506506
return;
507507
}
508508

509-
// Send the text to the terminal
510-
// Note: For bracketed paste mode, we would wrap this in \x1b[200~ ... \x1b[201~
511-
// but for now, send raw text
512-
this.onDataCallback(text);
509+
// Check if bracketed paste mode is enabled (DEC mode 2004)
510+
const hasBracketedPaste = this.getModeCallback?.(2004) ?? false;
511+
512+
if (hasBracketedPaste) {
513+
// Wrap with bracketed paste sequences
514+
this.onDataCallback('\x1b[200~' + text + '\x1b[201~');
515+
} else {
516+
// Send raw text
517+
this.onDataCallback(text);
518+
}
513519
}
514520

515521
/**

0 commit comments

Comments
 (0)