Repository navigation
fix: client: terminal: refit after show - #485
Open
giulianoliker wants to merge 1 commit into
Open
giulianoliker wants to merge 1 commit into
giulianoliker wants to merge 1 commit into
Conversation
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 <noreply@anthropic.com>
3 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the terminal opening at the wrong size, the known issue noted in #484 (Cyan-Sinko theme).
Cause:
terminal.jsandterminal-run.jscreate gritty ondocument.body. Gritty runs xterm's fit addon once at that point, against the body, and refits only on windowresize.View.showthen moves the terminal into the modal. Nothing refits it there, so its rows and columns still match the body, not the view.With
lightanddarkthe body and the view happen to give the same size, so the problem doesn't show. I measured both at 1920×1080, 1440×900, 1280×720, 1024×768, 880×800, 768×1024, 600×900 and 375×812, and the terminal fit every time. With a different page layout, such as the Cyan-Sinko theme, the terminal opens up to 252px taller than the view (bottom rows cut off) and uses only about 60% of the width, until the window is resized.Fix: dispatch
resizeinafterShow, so gritty refits to the view. Gritty keeps its fit addon private, so this triggers the refit through gritty's ownresizelistener. Cloud Commander's ownresizehandler also runs; it acts only below the one-panel width when the right panel is active, which is already the state there.Since gritty is also part of the Cloud Commander project, an alternative would be a small public
fit()in gritty instead of dispatchingresize. Happy to do it that way if you prefer.npm run fix:lintis OK (it leaves no changes)npm testis OK (364/364, on Linux with Node 24)Built with help from Claude Code; I reviewed and tested it myself.