The best way to control Claude Code, Codex and more from any computer or phone
fix(web): terminal paste keeps a leading U+FEFF without bracketed paste (#36018)
Julius Marminge committed
Nov 12, 2026 at 21:57 UTC
2cb56cbf56aa307e0ca67612f12f7aa8fdbd5295
2 files changed
+8
-1
apps/web/src/terminal/ghostty/core.test.ts
+7
@@ -122,6 +122,13 @@ describe("GhosttyTerminalCore snapshots", () => {
122
expect(terminalNavigationShortcutData(event, "Win32") ?? core.encodeKey(event)).toBe(expected);
123
});
124
125
+ it("keeps a leading U+FEFF in an unbracketed paste", async () => {
126
+ const core = await createCore();
127
+ core.write("\x1b[?2004l");
128
+
129
+ expect(core.encodePaste("\ufeffsample")).toBe("\ufeffsample");
130
+ });
131
+
132
it.each([
133
{ code: "", key: "Backspace", expected: "\x7f" },
134
{ code: "Unidentified", key: "Backspace", expected: "\x7f" },
apps/web/src/terminal/ghostty/core.ts
+1
-1
@@ -162,7 +162,7 @@ export interface GhosttyMouseInput {
162
readonly anyButtonPressed: boolean;
163
}
164
165
-const decoder = new TextDecoder();
165
+const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
166
const encoder = new TextEncoder();
167
168
function blend(foreground: GhosttyColor, background: GhosttyColor): GhosttyColor {