Skip to content

Commit

Permalink
Simplify term.onData handler
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek committed Jul 16, 2024
1 parent a940f83 commit b563bd9
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,12 @@ async function createTerminal(element: HTMLElement, toDispose: DisposableCollect
}
});

let buffer = '';
const unwantedSequence = '\x1b[0;276;0c';
term.onData((data) => {
buffer += data;

const unwantedSequence = '\x1b[0;276;0c';
if (buffer.includes(unwantedSequence)) {
buffer = buffer.replaceAll(unwantedSequence, '');
term.write(buffer);
if (data.includes(unwantedSequence)) {
const cleanedData = data.replaceAll(unwantedSequence, '');
term.write(cleanedData);
}
buffer = '';
});

toDispose.push(term);
Expand Down

0 comments on commit b563bd9

Please sign in to comment.