chore: some reformatting
Signed-off-by: mellobacon <mellodev@outlook.com>
mellobacon committed
Feb 10, 2024 at 15:01 UTC
d6f0bee0bbff4b311146572b966bc141314ebfb2
2 files changed
+20
-5
src/lib/Statusbar.svelte
+4
@@ -41,6 +41,10 @@
41
editortool.set({name: x.name, content: x.content});
42
}
43
}
44
+ export function hideBottomPanel() {
45
+ show = false;
46
+ showBottomPanel.set(false);
47
+ }
48
export function setTerminalState(value) {
49
let v = value === "true" ? true : false;
50
externalTerminal.set(v);
src/lib/Terminal.svelte
+16
-5
@@ -10,6 +10,7 @@
10
let terminalElement: HTMLElement;
11
12
function initializeXterm() {
13
+ createController();
14
terminalController.loadAddon(termFit);
15
terminalController.open(terminalElement);
16
fitTerminal();
@@ -28,15 +29,25 @@
29
30
export const termTheme = writable();
31
export const termOptions = writable();
31
-let terminalController = new Terminal({
32
- fontFamily: "Cascadia Mono",
33
- fontSize: 14,
34
-});
32
+let terminalController = null;
33
+
34
+export function createController() {
35
+ terminalController = new Terminal({
36
+ fontFamily: "Cascadia Mono",
37
+ fontSize: 14,
38
+ });
39
+}
40
+
41
+export function clearTerminal() {
42
+ terminalController.clear();
43
+}
44
45
export function updateTermTheme() {
46
+ if (!terminalController) return;
47
terminalController.options.theme = get(termTheme);
48
}
49
export function updateTermOptions() {
50
+ if (!terminalController) return;
51
const options: any = get(termOptions);
52
terminalController.options.fontFamily = options.fontFamily;
53
terminalController.options.fontSize = options.fontSize;
@@ -90,4 +101,4 @@ async function readFromPty() {
101
height: 97.5%;
102
width: 100%;
103
}
93
-</style>
\ No newline at end of file
104
+</style>