Small refactoring; Disabled window resizing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,8 +2,5 @@ import { defineConfig } from "vite";
|
||||
import { viteSingleFile } from "vite-plugin-singlefile";
|
||||
|
||||
export default defineConfig({
|
||||
esbuild: {
|
||||
keepNames: true,
|
||||
},
|
||||
plugins: [viteSingleFile()],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user