From 98b1f0201d2323880e5321c015311bcc7787d434 Mon Sep 17 00:00:00 2001 From: Giuliano <308090+giulianoliker@users.noreply.github.com> Date: Sun, 18 Oct 2026 22:48:12 -0400 Subject: [PATCH] fix: client: terminal: refit after show gritty fits the terminal to document.body when it is created and refits on window resize only, so after View.show moves it into the modal the size can be wrong until the window is resized. Dispatch resize in afterShow so gritty refits to the view. Co-Authored-By: Claude Opus 5.5 --- client/modules/terminal-run.js | 5 +++++ client/modules/terminal.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/client/modules/terminal-run.js b/client/modules/terminal-run.js index 029415eac1..896f302ebf 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 186ee0b240..dbbe352f3e 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'));