revert: keep xterm.js for the terminal
ghostty-web 0.4.0 corrupts cell positions after the pane resizes or remounts. In testing, seq output became a diagonal staircase and reopening at a new width mixed the prompt with old output. The release also has open bugs for Alt-key input and idle repainting. Keep xterm.js until those are fixed.
This commit is contained in:
1 parent
3f61dd4db8
commit
05660a244b
7 files changed
+58
-58
No files matched your search
@@ -1387,12 +1387,8 @@ button {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.terminal-host:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.terminal-host canvas {
|
||||
display: block;
|
||||
.terminal-host .xterm {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.preview-wrap {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import type { FitAddon as FitAddonInstance, Terminal as TerminalInstance } from 'ghostty-web'
|
||||
import '@xterm/xterm/css/xterm.css'
|
||||
import type { FitAddon as FitAddonInstance } from '@xterm/addon-fit'
|
||||
import type { Terminal as TerminalInstance } from '@xterm/xterm'
|
||||
|
||||
const props = defineProps<{ roomId: string }>()
|
||||
|
||||
@@ -164,40 +166,36 @@ function reconnect() {
|
||||
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
try {
|
||||
const { init, Terminal, FitAddon } = await import('ghostty-web')
|
||||
await init()
|
||||
if (disposed || !host.value) return
|
||||
const [{ Terminal }, { FitAddon }] = await Promise.all([
|
||||
import('@xterm/xterm'),
|
||||
import('@xterm/addon-fit'),
|
||||
])
|
||||
if (!host.value) return
|
||||
|
||||
term = new Terminal({
|
||||
convertEol: false,
|
||||
cursorBlink: true,
|
||||
fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--font-mono').trim(),
|
||||
fontSize: Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--fs-code')) || 13,
|
||||
scrollback: 3000,
|
||||
theme: terminalTheme(),
|
||||
})
|
||||
fit = new FitAddon()
|
||||
term.loadAddon(fit)
|
||||
term.open(host.value)
|
||||
term.onData((data) => {
|
||||
if (!socket || socket.readyState !== WebSocket.OPEN) return
|
||||
socket.send(new TextEncoder().encode(data))
|
||||
})
|
||||
term = new Terminal({
|
||||
convertEol: false,
|
||||
cursorBlink: true,
|
||||
fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--font-mono').trim(),
|
||||
fontSize: Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--fs-code')) || 13,
|
||||
scrollback: 3000,
|
||||
theme: terminalTheme(),
|
||||
})
|
||||
fit = new FitAddon()
|
||||
term.loadAddon(fit)
|
||||
term.open(host.value)
|
||||
term.onData((data) => {
|
||||
if (!socket || socket.readyState !== WebSocket.OPEN) return
|
||||
socket.send(new TextEncoder().encode(data))
|
||||
})
|
||||
|
||||
observer = new ResizeObserver(() => {
|
||||
scheduleFit()
|
||||
})
|
||||
observer.observe(host.value)
|
||||
|
||||
term.focus()
|
||||
observer = new ResizeObserver(() => {
|
||||
scheduleFit()
|
||||
connect()
|
||||
} catch (error) {
|
||||
status.value = 'disconnected'
|
||||
detail.value = 'The terminal emulator could not start.'
|
||||
console.error('terminal emulator failed to start', error)
|
||||
}
|
||||
})
|
||||
observer.observe(host.value)
|
||||
|
||||
term.focus()
|
||||
scheduleFit()
|
||||
connect()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
Reference in new issue
Block a user