diff --git a/client/modules/terminal-run.js b/client/modules/terminal-run.js index 029415eac..896f302eb 100644 --- a/client/modules/terminal-run.js +++ b/client/modules/terminal-run.js @@ -65,6 +65,7 @@ const runTerminal = promisify((options, fn) => { CloudCmd.View.show(Terminal.element, { afterShow: () => { + refit(); Terminal.focus(); }, afterClose: (/* exec.series args */) => { @@ -77,6 +78,10 @@ export function hide() { CloudCmd.View.hide(); } +// gritty fits the terminal to document.body on create, +// and refits on window resize only +const refit = () => globalThis.dispatchEvent(new Event('resize')); + const getPrefix = () => CloudCmd.prefix + '/gritty'; function getPrefixSocket() { diff --git a/client/modules/terminal.js b/client/modules/terminal.js index 186ee0b24..dbbe352f3 100644 --- a/client/modules/terminal.js +++ b/client/modules/terminal.js @@ -107,7 +107,12 @@ export function show() { CloudCmd.View.show(Terminal.element, { afterShow: () => { + refit(); Terminal.focus(); }, }); } + +// gritty fits the terminal to document.body on create, +// and refits on window resize only +const refit = () => globalThis.dispatchEvent(new Event('resize'));