diff --git a/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx b/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx index d75445961d..49f6a63c3c 100644 --- a/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx +++ b/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx @@ -8,6 +8,7 @@ interface IRemixDragBarUi { setHideStatus: (hide: boolean) => void hidden: boolean minHeight?: number + onResize: (height: number) => void } const DragBar = (props: IRemixDragBarUi) => { @@ -19,6 +20,7 @@ const DragBar = (props: IRemixDragBarUi) => { const h = window.innerHeight - data.y props.refObject.current.setAttribute('style', `height: ${h}px;`) setDragBarPosY(props.refObject.current.offsetTop) + props.onResize(h) setDragState(false) props.setHideStatus(false) } diff --git a/libs/remix-ui/panel/src/lib/main/main-panel.tsx b/libs/remix-ui/panel/src/lib/main/main-panel.tsx index 30dafed2be..cfa335dc01 100644 --- a/libs/remix-ui/panel/src/lib/main/main-panel.tsx +++ b/libs/remix-ui/panel/src/lib/main/main-panel.tsx @@ -52,13 +52,17 @@ const RemixUIMainPanel = (props: RemixUIMainPanelProps) => { appContext.layout.emit('change', appContext.layout.panels) } + const resize = (height: number) => { + appContext.layout.emit('resize', height) + } + return (
{Object.values(plugins).map((pluginRecord, i) => { return ( {pluginRecord.profile.name === 'terminal' ? ( - + ) : null} diff --git a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx index aafc7d2526..703b335f7f 100644 --- a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx +++ b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx @@ -46,10 +46,16 @@ const RemixUiXterm = (props: RemixUiXtermProps) => { } },[theme]) + useEffect(() => { + fitAddon.fit() + },[timeStamp]) + const onResize = (event: { cols: number; rows: number }) => { resize(event, pid) } + + return ( { handleThemeChange(theme) }) + plugin.on('layout', 'resize', async (height: number) => { + setTerminals(prevState => { + const terminal = prevState.find(xtermState => xtermState.hidden === false) + if (terminal) { + if (terminal.ref && terminal.ref.terminal) { + terminal.timeStamp = Date.now() + } + } + return [...prevState] + }) + }) + const theme = await plugin.call('theme', 'currentTheme') handleThemeChange(theme) diff --git a/libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts b/libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts index 82284051af..9066fa05d9 100644 --- a/libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts +++ b/libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts @@ -85,7 +85,7 @@ export class FitAddon implements ITerminalAddon { const availableWidth = parentElementWidth - elementPaddingHor - scrollbarWidth; const geometry = { cols: Math.max(MINIMUM_COLS, Math.floor(availableWidth / dims.css.cell.width)), - rows: Math.max(MINIMUM_ROWS, Math.floor(availableHeight / dims.css.cell.height)) + rows: Math.max(MINIMUM_ROWS, Math.floor((availableHeight - 17) / dims.css.cell.height)) }; return geometry; diff --git a/libs/remix-ui/xterm/src/lib/css/index.css b/libs/remix-ui/xterm/src/lib/css/index.css index 09868262ea..d7a13a031f 100644 --- a/libs/remix-ui/xterm/src/lib/css/index.css +++ b/libs/remix-ui/xterm/src/lib/css/index.css @@ -45,6 +45,7 @@ .xterm-panel-header { display: flex; flex-direction: row; + } .xterm-panel-header-left {