@@ -20,21 +20,25 @@ export function DashboardTerminal({ tabId }: DashboardTerminalProps): React.Reac
2020
2121 const originalParent = termEl . parentElement
2222
23+ const origWidth = termEl . offsetWidth
24+ const origHeight = termEl . offsetHeight
25+
26+ termEl . style . width = `${ origWidth } px`
27+ termEl . style . height = `${ origHeight } px`
28+
2329 container . appendChild ( termEl )
2430 entry . terminal . scrollToBottom ( )
2531
2632 const viewport = termEl . querySelector ( '.xterm-viewport' ) as HTMLElement | null
2733 const prevOverflow = viewport ?. style . overflowY ?? ''
2834 if ( viewport ) viewport . style . overflowY = 'hidden'
2935
30- const termWidth = termEl . offsetWidth
31- const termHeight = termEl . offsetHeight
3236 const containerWidth = container . clientWidth
3337 const containerHeight = container . clientHeight
3438
35- if ( termWidth > 0 && termHeight > 0 && containerWidth > 0 && containerHeight > 0 ) {
36- const scaleX = containerWidth / termWidth
37- const scaleY = containerHeight / termHeight
39+ if ( origWidth > 0 && origHeight > 0 && containerWidth > 0 && containerHeight > 0 ) {
40+ const scaleX = containerWidth / origWidth
41+ const scaleY = containerHeight / origHeight
3842 const scale = Math . min ( scaleX , scaleY )
3943 termEl . style . transform = `scale(${ scale } )`
4044 termEl . style . transformOrigin = 'top left'
@@ -44,6 +48,8 @@ export function DashboardTerminal({ tabId }: DashboardTerminalProps): React.Reac
4448 if ( viewport ) viewport . style . overflowY = prevOverflow
4549 termEl . style . transform = ''
4650 termEl . style . transformOrigin = ''
51+ termEl . style . width = ''
52+ termEl . style . height = ''
4753 if ( originalParent ) {
4854 originalParent . appendChild ( termEl )
4955 }
0 commit comments