A terminal's size follows the viewer in use, not whoever fitted last - #229
Merged
Merged
Conversation
One task open on the desktop and the phone (or in two windows) shares one PTY, and every viewer pushed its own fit straight to it: the phone opening the task shrank the desktop's terminal to phone width, for good. Now the first viewer to report a size holds it, typing on a viewer hands the size over (applying its remembered size at once), and a closed connection releases it. Each RPC connection and each desktop window is a distinct viewer.
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.
One task open on the desktop and the phone (or in two desktop windows) shares one PTY, and every viewer pushed its own xterm fit straight to it. Last writer won: the phone merely opening the task (or showing its keyboard) shrank the desktop's terminal to phone width, and the desktop never recovered because it only re-reports when its own grid changes.
Now the PTY follows the viewer in use, tmux's
window-size latestrule:Each
serveRpcconnection gets an id (desktop and phone are distinct viewers on a box), and the desktop IPC bridge names each window by its webContents so two local windows are distinct too. The policy is one pure module (size-arbiter.ts); the dispatcher routes onlypty:writeandpty:resizethrough it. The PTY daemon is untouched.Known trade-off: a non-owner viewer still fits its xterm to its own screen, so the phone shows desktop-width output wrapped until you type on it. Follow-up: broadcast the PTY size so non-owner viewers render the PTY grid.
Tests: arbiter policy, dispatcher with two clients, and a two-WebSocket end-to-end run including release on close.