Skip to content

Commit

Permalink
Remove terminal bg for lolcat
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinBrett committed Dec 8, 2024
1 parent f19b22b commit 443c2d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions components/apps/Terminal/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ export const printColor = (
)}`
}\u001B[0m`;

export const clearAnsiBackground = (text: string): string =>
text.replace(/;48;2;/g, ";48;0;").replace(/;48;5;/g, ";48;0;");

export const readClipboardToTerminal = (localEcho: LocalEcho): void => {
try {
navigator.clipboard
Expand Down
8 changes: 6 additions & 2 deletions components/apps/Terminal/loadWapm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
WAPM_STD_IN_EXCLUDE_ARGS,
config,
} from "components/apps/Terminal/config";
import { parseCommand } from "components/apps/Terminal/functions";
import {
clearAnsiBackground,
parseCommand,
} from "components/apps/Terminal/functions";
import { getExtension } from "utils/functions";

type WASIError = Error & {
Expand Down Expand Up @@ -225,7 +228,8 @@ const loadWapm = async (
sendStderr: (buffer: Uint8Array) => print(buffer.toString()),
sendStdout: (buffer: Uint8Array) => {
if (stdIn) exitStdIn = true;
print(buffer.toString());
const output = buffer.toString();
print(stdIn ? clearAnsiBackground(output) : output);
},
});
const instance = await WebAssembly.instantiate(
Expand Down

0 comments on commit 443c2d7

Please sign in to comment.