Replay bracketed paste in terminal preamble

This commit is contained in:
Mohamed Boudra
2026-06-19 11:08:49 +07:00
parent e5322b5b63
commit 25349e0fe5
2 changed files with 5 additions and 0 deletions

View File

@@ -106,6 +106,7 @@ describe("TerminalInputModeTracker", () => {
applicationCursorKeys: false, applicationCursorKeys: false,
bracketedPaste: true, bracketedPaste: true,
}); });
expect(tracker.getPreamble()).toBe("\x1b[?2004h");
expect(tracker.feed("\x1b[?2004l").changed).toBe(true); expect(tracker.feed("\x1b[?2004l").changed).toBe(true);
expect(tracker.getState()).toEqual({ expect(tracker.getState()).toEqual({
@@ -114,6 +115,7 @@ describe("TerminalInputModeTracker", () => {
applicationCursorKeys: false, applicationCursorKeys: false,
bracketedPaste: false, bracketedPaste: false,
}); });
expect(tracker.getPreamble()).toBe("");
}); });
it("ignores encoded key input sequences", () => { it("ignores encoded key input sequences", () => {

View File

@@ -156,6 +156,9 @@ export class TerminalInputModeTracker {
if (this.applicationCursorKeys) { if (this.applicationCursorKeys) {
parts.push("\x1b[?1h"); parts.push("\x1b[?1h");
} }
if (this.bracketedPaste) {
parts.push("\x1b[?2004h");
}
return parts.join(""); return parts.join("");
} }