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(() => {
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@
|
||||
"typecheck": "nuxt typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"ghostty-web": "0.4.0",
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"lucide-vue-next": "^1.0.0",
|
||||
"nuxt": "^4.7.0",
|
||||
"vue": "^3.5.0"
|
||||
|
||||
Generated
+16
-8
@@ -8,9 +8,12 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
ghostty-web:
|
||||
specifier: 0.4.0
|
||||
version: 0.4.0
|
||||
'@xterm/addon-fit':
|
||||
specifier: ^0.11.0
|
||||
version: 0.11.0
|
||||
'@xterm/xterm':
|
||||
specifier: ^6.0.0
|
||||
version: 6.0.0
|
||||
lucide-vue-next:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(vue@3.5.46(typescript@5.9.3))
|
||||
@@ -1160,6 +1163,12 @@ packages:
|
||||
'@vue/shared@3.5.46':
|
||||
resolution: {integrity: sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==}
|
||||
|
||||
'@xterm/addon-fit@0.11.0':
|
||||
resolution: {integrity: sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==}
|
||||
|
||||
'@xterm/xterm@6.0.0':
|
||||
resolution: {integrity: sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==}
|
||||
|
||||
abbrev@3.0.1:
|
||||
resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==}
|
||||
engines: {node: ^18.17.0 || >=20.5.0}
|
||||
@@ -1678,9 +1687,6 @@ packages:
|
||||
get-port-please@3.2.0:
|
||||
resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==}
|
||||
|
||||
ghostty-web@0.4.0:
|
||||
resolution: {integrity: sha512-0puDBik2qapbD/QQBW9o5ZHfXnZBqZWx/ctBiVtKZ6ZLds4NYb+wZuw1cRLXZk9zYovIQ908z3rvFhexAvc5Hg==}
|
||||
|
||||
giget@3.3.1:
|
||||
resolution: {integrity: sha512-r+mvuDjrjMpsdw46Kmeydb8bdHm7wOKw8wNBtTndkjbPjgAp5oUJUxRE76wZFknxIPokfWvep2qSXK37aXE6zg==}
|
||||
hasBin: true
|
||||
@@ -4135,6 +4141,10 @@ snapshots:
|
||||
|
||||
'@vue/shared@3.5.46': {}
|
||||
|
||||
'@xterm/addon-fit@0.11.0': {}
|
||||
|
||||
'@xterm/xterm@6.0.0': {}
|
||||
|
||||
abbrev@3.0.1: {}
|
||||
|
||||
abort-controller@3.0.0:
|
||||
@@ -4577,8 +4587,6 @@ snapshots:
|
||||
|
||||
get-port-please@3.2.0: {}
|
||||
|
||||
ghostty-web@0.4.0: {}
|
||||
|
||||
giget@3.3.1: {}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
|
||||
Reference in new issue
Block a user