Skip to content

Commit 006dedb

Browse files
author
Cosmo Grant
committed
handle \t control character
1 parent 14eae20 commit 006dedb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎frontend/src/components/editor/output/ansi-reduce.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TerminalBuffer {
6969
this.cursor.col += str.length;
7070
}
7171

72-
/** Handle simple control characters (\n, \r). */
72+
/** Handle simple control characters (\n, \r, \t). */
7373
control(ch: string) {
7474
switch (ch) {
7575
case "\n":
@@ -80,6 +80,9 @@ export class TerminalBuffer {
8080
case "\r":
8181
this.cursor.col = 0;
8282
break;
83+
case "\t":
84+
this.writeChar("\t");
85+
break;
8386
}
8487
}
8588

@@ -268,11 +271,11 @@ export class AnsiReducer {
268271
const ch = text[i];
269272

270273
// Handle control characters
271-
if (ch === "\n" || ch === "\r") {
274+
if (ch === "\n" || ch === "\r" || ch === "\t") {
272275
// Write accumulated text before the control character
273276
if (i > start) {
274277
const segment = text.slice(start, i);
275-
// Filter out characters below space (but we already have \n and \r handled)
278+
// Filter out characters below space (but we already have \n, \r, \t handled)
276279
const filtered = this.filterControlChars(segment);
277280
if (filtered.length > 0) {
278281
this.buffer.writeString(filtered);
@@ -302,7 +305,7 @@ export class AnsiReducer {
302305
}
303306
}
304307

305-
/** Filter out control characters below space (except \n and \r which are handled separately). */
308+
/** Filter out control characters below space (except \n, \r, \t which are handled separately). */
306309
private filterControlChars(text: string): string {
307310
// Fast path: if no control chars, return as-is
308311
let hasControlChars = false;

0 commit comments

Comments
 (0)