Repository navigation
fix(terminal): keep resizing after initial connection failure - #285
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add lifecycle test coverage or complete the stated GUI acceptance before merging.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes terminal pane resizing after an initial connection failure or cancellation.
Changes:
- Registers
ResizeObserverbefore asynchronous connection setup. - Preserves zero-size protection and cleanup on pane destruction.
| File | Summary |
|---|---|
src/lib/components/TerminalPane.svelte |
Ensures resize handling persists throughout the pane lifecycle. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1621
to
+1625
| resizeObs = new ResizeObserver((entries) => { | ||
| // Skip fitting when the container is hidden (display:none | ||
| // collapses dimensions to zero) — fitting at 0×0 corrupts | ||
| // xterm's column count and causes the narrow-tab bug. | ||
| const { width, height } = entries[0].contentRect; |
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.

Terminal panes can stop resizing after an initial connection fails or is cancelled. The resize observer was registered only after the first successful connection; an early return skipped registration, and reconnecting never installed it.
Register the observer immediately after opening and fitting xterm, before asynchronous setup. Keep the existing zero-size guard and observer cleanup on pane destruction.
Desktop GUI, mobile GUI, and the shared Headless/JetBrains frontend use this fix. CLI: not applicable (terminal-pane UI only).
Validation:
npm test: 780 tests passed.npm run build: passed.cargo fmt --manifest-path src-tauri/Cargo.toml --check: passed.cargo test --locked --offline --manifest-path src-tauri/Cargo.toml: 744 tests passed; one documentation test ignored.git diff --check: passed.The pre-fix failure was reproduced: the pane width changed from 862 to 931 while xterm stayed at 978, and the heap snapshot confirmed the active pane had no ResizeObserver. Post-fix GUI acceptance is still pending: resize during an initial connection failure, retry and disconnect, hide/show the tab, and close the pane. Existing automated tests do not directly exercise this component lifecycle.