Skip to content

Commit 29a5469

Browse files
fix(server): a decoded U+009C no longer ends an OSC string in terminal history
Fixes #36012 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent e914e76 commit 29a5469

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/server/src/terminal/Manager.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,7 @@ function stripStringTerminator(value: string): string {
11871187
if (value.endsWith("\u001b\\")) {
11881188
return value.slice(0, -2);
11891189
}
1190-
const lastCharacter = value.at(-1);
1191-
if (lastCharacter === "\u0007" || lastCharacter === "\u009c") {
1190+
if (value.endsWith("\u0007")) {
11921191
return value.slice(0, -1);
11931192
}
11941193
return value;
@@ -1197,7 +1196,8 @@ function stripStringTerminator(value: string): string {
11971196
function findStringTerminatorIndex(input: string, start: number): number | null {
11981197
for (let index = start; index < input.length; index += 1) {
11991198
const codePoint = input.charCodeAt(index);
1200-
if (codePoint === 0x07 || codePoint === 0x9c || isControlSequenceCancel(codePoint)) {
1199+
// libghostty reads a decoded U+009C as UTF-8 payload, not ST.
1200+
if (codePoint === 0x07 || isControlSequenceCancel(codePoint)) {
12011201
return index + 1;
12021202
}
12031203
// Like xterm.js, an ESC that does not start ST ends the string and begins the next sequence.

0 commit comments

Comments
 (0)