fix: spawn pty with actual terminal size#23
Merged
jmaxdev merged 2 commits intoTrixtyAI:mainfrom Apr 19, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an initial PTY size mismatch by ensuring the shell is spawned with the terminal’s actual rows/cols (instead of a hardcoded 24×80), addressing the prompt rendering artifact described in issue #13.
Changes:
- Extend
spawn_ptyto accept optionalrows/cols(with a 24×80 fallback). - Update the frontend invoke typing to include the new PTY size parameters.
- Fit the xterm instance before spawning the PTY, then pass the computed
term.rows/term.colsintospawn_pty.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/desktop/src/components/Terminal.tsx | Stores FitAddon in a ref, calls fit() before spawning, and passes rows/cols to the PTY spawn invoke. |
| apps/desktop/src/api/tauri.ts | Updates the typed invoke map for spawn_pty to include optional rows/cols. |
| apps/desktop/src-tauri/src/pty.rs | Updates the Tauri spawn_pty command to size the PTY using provided rows/cols with a default fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
|
done |
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.
Changes
The PTY was hardcoded to open at 24 rows × 80 cols in
pty.rs. The shell (PowerShell/bash) would then print its first prompt at 80 cols, and the real size only arrived later viaresize_ptywhen theResizeObserverinTerminal.tsxfired. That mismatch caused the symptom reported in #13 — after commands likels/dirfollowed byclear, the prompt rendered with an extra blank and a truncated path.apps/desktop/src-tauri/src/pty.rs:spawn_ptynow accepts optionalrows/cols, falling back to 24×80 if not provided.apps/desktop/src/api/tauri.ts: extends thespawn_ptysignature accordingly.apps/desktop/src/components/Terminal.tsx: stores theFitAddonin a ref so the PTY effect can callfit()before spawning, then passesterm.rows/term.colstospawn_ptyso the shell starts at the correct size.The existing
ResizeObserver+resize_ptyflow is untouched — it still handles later container resizes.Issues