[feat:global] terminal mode and unit testing#3
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Store spawn errors and deliver them to the first attaching socket, rather than broadcasting to an empty set - Remove dead sessions from TerminalManager on natural PTY exit via onCleanup callback - Reset idle timer on socket reconnect in attach() - Narrow broadcast() parameter to a typed TerminalServerMessage union Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…smatch The PTY was spawned with hardcoded cols=220 rows=50. The claude CLI reads terminal dimensions at startup via TIOCGWINSZ and draws its TUI at those dimensions. xterm.js renders at the actual container width (~120 cols), causing line wrapping and scrambled display. Two-part fix: - Backend: PTY now spawns lazily on the first resize message, using the exact dimensions measured by the browser. Reconnecting clients skip the wait and receive connected immediately. - Frontend: useTerminalSession accepts an onConnect callback fired on ws.onopen. TerminalSession uses it to call fit.fit(), which sends the resize through the now-open WebSocket before the PTY starts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PTY exit/kill now closes WebSocket connections so the frontend reconnect loop fires and spawns a fresh PTY automatically on reconnect. Session resume now uses the current global session_mode setting instead of the stored session mode, so switching modes in Settings takes effect immediately when opening any existing session. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
xterm.js only fires onResize when cols/rows actually change. On reconnect the terminal is already at the correct size, so fit.fit() was a no-op, no resize message was sent, and the PTY never spawned. onConnect now explicitly sends the post-fit dimensions via a stable ref, guaranteeing the spawn-triggering resize message is delivered on every connection, including reconnects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation TerminalSession was unmounting when navigating to the sessions list (SESSION_CLEARED sets sessionId=null), destroying the xterm instance and losing all scrollback. On resume the fresh xterm showed blank because the running PTY was idle and sent no new output. Fix matches the TerminalDrawer pattern: keep TerminalSession always mounted, CSS-hide its wrapper when not in an active terminal session. The xterm instance and scroll buffer survive the trip to the list and back. Also: clear the terminal when switching to a different session (not same session resume), and guard ResizeObserver against zero-size callbacks from hidden containers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Backend accumulates up to 256 KB of PTY output per session in a circular
scrollback buffer. On reconnect (existing PTY), it sends the buffer as a
{type: 'history'} message before {type: 'status', state: 'connected'}.
Frontend clears the xterm viewport and replays the history on receipt,
restoring the terminal state after a page refresh. Works in tandem with
the CSS-toggle approach: navigation-within-app uses the preserved xterm
instance; page refresh uses history replay from the backend buffer.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
No description provided.