Skip to content

Commit b563bd9

Browse files
committed
Simplify term.onData handler
1 parent a940f83 commit b563bd9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/client.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,12 @@ async function createTerminal(element: HTMLElement, toDispose: DisposableCollect
160160
}
161161
});
162162

163-
let buffer = '';
163+
const unwantedSequence = '\x1b[0;276;0c';
164164
term.onData((data) => {
165-
buffer += data;
166-
167-
const unwantedSequence = '\x1b[0;276;0c';
168-
if (buffer.includes(unwantedSequence)) {
169-
buffer = buffer.replaceAll(unwantedSequence, '');
170-
term.write(buffer);
165+
if (data.includes(unwantedSequence)) {
166+
const cleanedData = data.replaceAll(unwantedSequence, '');
167+
term.write(cleanedData);
171168
}
172-
buffer = '';
173169
});
174170

175171
toDispose.push(term);

0 commit comments

Comments
 (0)