Small refactoring; Disabled window resizing

This commit is contained in:
2023-03-05 10:15:31 +01:00
parent f86d0e662b
commit 23beb7d12b
3 changed files with 21 additions and 19 deletions

View File

@@ -1,25 +1,27 @@
import { Terminal } from "xterm";
const term = new Terminal({
fontFamily:
'"Fira Code", courier-new, courier, monospace, "Powerline Extra Symbols"',
});
const term = new Terminal();
let line = "";
let command = "";
term.onKey(({ key, domEvent }) => {
const printable = !(domEvent.altKey || domEvent.ctrlKey || domEvent.metaKey);
const isPrintable = !(
domEvent.altKey ||
domEvent.ctrlKey ||
domEvent.metaKey
);
if (domEvent.key === "Enter") {
//@ts-ignore
window.__WRITE_PTY(line);
window.__WRITE_PTY(command);
term.writeln("");
line = "";
command = "";
return;
}
if (printable) {
if (isPrintable) {
term.write(key);
line += key;
command += key;
}
});

View File

@@ -2,8 +2,5 @@ import { defineConfig } from "vite";
import { viteSingleFile } from "vite-plugin-singlefile";
export default defineConfig({
esbuild: {
keepNames: true,
},
plugins: [viteSingleFile()],
});