fix: console sizing issues (#6540)

fix: console sizing issues (for good)
This commit is contained in:
Calum H.
2026-06-29 14:38:30 +00:00
committed by GitHub
parent 204bd52a5a
commit b09c26f616
8 changed files with 63 additions and 12 deletions
@@ -189,14 +189,31 @@ function handleDocumentPointerDown(event: PointerEvent) {
terminal.value.clearSelection()
}
function handleDocumentKeyDown(event: KeyboardEvent) {
if (!event.metaKey || event.key.toLowerCase() !== 'a') return
const target = event.target as Node | null
const active = document.activeElement
if (
!(target && containerRef.value?.contains(target)) &&
!(active && containerRef.value?.contains(active))
) {
return
}
event.preventDefault()
terminal.value?.selectAll()
}
onMounted(() => {
window.addEventListener('resize', handleWindowResize)
document.addEventListener('pointerdown', handleDocumentPointerDown)
document.addEventListener('keydown', handleDocumentKeyDown, true)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', handleWindowResize)
document.removeEventListener('pointerdown', handleDocumentPointerDown)
document.removeEventListener('keydown', handleDocumentKeyDown, true)
if (resizeDebounce) clearTimeout(resizeDebounce)
})