diff --git a/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue b/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue index 29a9eabc7..bc4ba4ace 100644 --- a/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/CommandTerminal.vue @@ -20,11 +20,16 @@ const terminalCreated = ( let offData: IDisposable let offOutput: () => void - useAutoSize(root, true, true, () => { - // If we aren't visible, don't resize - if (!terminal.element?.offsetParent) return + useAutoSize({ + root, + autoRows: true, + autoCols: true, + onResize: () => { + // If we aren't visible, don't resize + if (!terminal.element?.offsetParent) return - terminalApi.resize(terminal.cols, terminal.rows) + terminalApi.resize(terminal.cols, terminal.rows) + } }) onMounted(async () => { diff --git a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue index 7c1d4652e..508c1a14b 100644 --- a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue @@ -29,7 +29,7 @@ const terminalCreated = ( { terminal, useAutoSize }: ReturnType, root: Ref ) => { - useAutoSize(root, true, false) + useAutoSize({ root, autoRows: true, autoCols: false }) const update = (entries: Array, size?: TerminalSize) => { if (size) { diff --git a/src/hooks/bottomPanelTabs/useTerminal.ts b/src/hooks/bottomPanelTabs/useTerminal.ts index 7040c6e4a..4ed5f4644 100644 --- a/src/hooks/bottomPanelTabs/useTerminal.ts +++ b/src/hooks/bottomPanelTabs/useTerminal.ts @@ -36,12 +36,17 @@ export function useTerminal(element: Ref) { return { terminal, - useAutoSize( - root: Ref, - autoRows: boolean = true, - autoCols: boolean = true, + useAutoSize({ + root, + autoRows = true, + autoCols = true, + onResize + }: { + root: Ref + autoRows?: boolean + autoCols?: boolean onResize?: () => void - ) { + }) { const ensureValidRows = (rows: number | undefined) => { if (rows == null || isNaN(rows)) { return root.value?.clientHeight / 20 diff --git a/src/views/ServerStartView.vue b/src/views/ServerStartView.vue index 39c5e1a7b..46ae292ba 100644 --- a/src/views/ServerStartView.vue +++ b/src/views/ServerStartView.vue @@ -78,7 +78,7 @@ const terminalCreated = ( ) => { xterm = terminal - useAutoSize(root, true, true) + useAutoSize({ root, autoRows: true, autoCols: true }) electron.onLogMessage((message: string) => { terminal.write(message) })