|
1 | 1 | import { useRef, useEffect, useState } from "react"; |
2 | | -import { Terminal, FitAddon } from "ghostty-web"; |
| 2 | +import { init, Terminal, FitAddon } from "ghostty-web"; |
3 | 3 | import { useTerminalSession } from "@/browser/hooks/useTerminalSession"; |
4 | 4 | import { useAPI } from "@/browser/contexts/API"; |
5 | 5 |
|
@@ -78,39 +78,23 @@ export function TerminalView({ workspaceId, sessionId, visible }: TerminalViewPr |
78 | 78 |
|
79 | 79 | const initTerminal = async () => { |
80 | 80 | try { |
| 81 | + // Initialize ghostty-web WASM module (idempotent, safe to call multiple times) |
| 82 | + await init(); |
| 83 | + |
81 | 84 | terminal = new Terminal({ |
82 | | - fontSize: 13, |
83 | | - fontFamily: "Monaco, Menlo, 'Courier New', monospace", |
| 85 | + fontSize: 14, |
| 86 | + fontFamily: "JetBrains Mono, Menlo, Monaco, monospace", |
84 | 87 | cursorBlink: true, |
85 | 88 | theme: { |
86 | 89 | background: "#1e1e1e", |
87 | 90 | foreground: "#d4d4d4", |
88 | | - cursor: "#d4d4d4", |
89 | | - cursorAccent: "#1e1e1e", |
90 | | - selectionBackground: "#264f78", |
91 | | - black: "#000000", |
92 | | - red: "#cd3131", |
93 | | - green: "#0dbc79", |
94 | | - yellow: "#e5e510", |
95 | | - blue: "#2472c8", |
96 | | - magenta: "#bc3fbc", |
97 | | - cyan: "#11a8cd", |
98 | | - white: "#e5e5e5", |
99 | | - brightBlack: "#666666", |
100 | | - brightRed: "#f14c4c", |
101 | | - brightGreen: "#23d18b", |
102 | | - brightYellow: "#f5f543", |
103 | | - brightBlue: "#3b8eea", |
104 | | - brightMagenta: "#d670d6", |
105 | | - brightCyan: "#29b8db", |
106 | | - brightWhite: "#ffffff", |
107 | 91 | }, |
108 | 92 | }); |
109 | 93 |
|
110 | 94 | const fitAddon = new FitAddon(); |
111 | 95 | terminal.loadAddon(fitAddon); |
112 | 96 |
|
113 | | - await terminal.open(containerRef.current!); |
| 97 | + terminal.open(containerRef.current!); |
114 | 98 | fitAddon.fit(); |
115 | 99 |
|
116 | 100 | const { cols, rows } = terminal; |
|
0 commit comments