fix: highlight inactive terminal output#19
Open
htazq wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds transient unread-output state for terminal tabs so background terminal activity can be visually indicated and cleared when the tab/group is activated.
Changes:
- Adds
hasUnreadOutputtab state and reducer actions/clearing behavior. - Wires PTY output events into terminal group state without rebuilding PTY sessions.
- Adds a blue pulsing unread-output indicator and related tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/lib/terminal-group-types.ts |
Adds unread-output tab state and action type. |
src/lib/terminal-group-serializer.ts |
Strips transient unread state from persisted terminal layout. |
src/lib/terminal-group-reducer.ts |
Marks/clears unread output in terminal group state. |
src/lib/terminal-group-context.tsx |
Resets unread state during startup restoration. |
src/components/terminal/terminal-group-view.tsx |
Dispatches unread-output state updates from PTY output. |
src/components/terminal/group-tab-bar.tsx |
Renders the unread-output indicator. |
src/components/pty-terminal.tsx |
Adds PTY output callback support. |
src/__tests__/terminal-group-reducer.test.ts |
Covers unread mark/clear reducer behavior. |
src/__tests__/pty-terminal-activation.test.tsx |
Covers PTY output notification. |
src/__tests__/group-tab-bar-unread-output.test.tsx |
Covers unread indicator rendering. |
Comment on lines
+189
to
+193
| <span | ||
| data-testid={`tab-unread-output-${tab.id}`} | ||
| aria-label="Unread terminal output" | ||
| className="absolute -right-1.5 -top-1.5 h-2 w-2 rounded-full bg-sky-500 ring-2 ring-background animate-pulse" | ||
| /> |
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.
Root cause
PTY output was written directly into each xterm instance, but the terminal tab state had no transient activity flag. Hidden terminal tabs could receive output while remaining visually identical to inactive idle tabs, and there was no reducer path to clear an activity marker when the user switched back.
Fix
hasUnreadOutputtab state and aMARK_TAB_UNREAD_OUTPUTreducer action.ACTIVATE_TABand when activating a group whose active tab has unread output.onOutputcallback toPtyTerminalusing a ref so tab switching does not rebuild xterm, WebSocket, or PTY sessions.saveStatenow tolerates older state withouttabToGroupMap.Closes #15
Verification
RED/GREEN:
pnpm.cmd test src/__tests__/terminal-group-reducer.test.tsfailed on unread mark/clear assertions before the fix.pnpm.cmd test src/__tests__/pty-terminal-activation.test.tsxfailed because PTYOutputdid not notify React state.pnpm.cmd test src/__tests__/group-tab-bar-unread-output.test.tsxfailed because no unread indicator was rendered.Passed:
pnpm.cmd test src/__tests__/terminal-group-reducer.test.ts src/__tests__/terminal-group-reducer.property.test.tspnpm.cmd test src/__tests__/group-tab-bar-unread-output.test.tsx src/__tests__/pty-terminal-activation.test.tsxpnpm.cmd test src/__tests__/terminal-group-serializer.test.tspnpm.cmd exec tsc --noEmitpnpm.cmd lint(0 errors; existing warnings remain)pnpm.cmd buildKnown local failures unrelated to this change:
pnpm.cmd testnow has 23 passing files and 2 failing existing suites:src/__tests__/connection.test.tsneeds a Tauri runtime/invoke bridge, andsrc/__tests__/file-entry-types.test.tshas Windows path separator expectation failures. The Feature request: Highlight inactive terminal tabs when new output arrives #15 tests pass in the full run.cd src-tauri && cargo testwas checked during this issue pass and fails locally becauseopenssl-syscannot findperlwhile building vendored OpenSSL.