Skip to content

feat(terminal): press R to reconnect disconnected sessions#52

Open
htazq wants to merge 1 commit into
GOODBOY008:mainfrom
htazq:fix/issue-12-reconnect-shortcut
Open

feat(terminal): press R to reconnect disconnected sessions#52
htazq wants to merge 1 commit into
GOODBOY008:mainfrom
htazq:fix/issue-12-reconnect-shortcut

Conversation

@htazq

@htazq htazq commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • allow R / r to reconnect only the active disconnected terminal
  • keep connected terminal input unchanged and ignore modified, repeated, or IME key events
  • honor the existing Auto Reconnect setting when a PTY connection closes
  • show localized manual reconnect guidance after automatic reconnect is disabled or exhausted

Verification

  • pnpm test src/__tests__/pty-terminal-activation.test.tsx src/__tests__/terminal-tab-portals.test.tsx src/__tests__/keyboard-shortcuts-hook.test.tsx src/__tests__/keyboard-shortcuts.test.ts (40 passed)
  • pnpm exec tsc --noEmit
  • pnpm exec eslint src/components/pty-terminal.tsx src/components/terminal/terminal-tab-portals.tsx --quiet
  • pnpm i18n:check
  • pnpm build

Full pnpm test: 476 passed; the 7 existing src/__tests__/connection.test.ts cases still require a Tauri runtime and fail in plain Vitest because window.__TAURI_INTERNALS__.invoke is unavailable.

Closes #12

tookdes pushed a commit to tookdes/r-shell that referenced this pull request Jul 19, 2026
tookdes pushed a commit to tookdes/r-shell that referenced this pull request Jul 19, 2026
Resolve test conflicts with GOODBOY008#52 by keeping both reconnect and unread-output suites.
@GOODBOY008
GOODBOY008 requested a review from Copilot July 20, 2026 10:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a keyboard-first reconnect workflow for terminal tabs by allowing R/r to trigger reconnect only when the active terminal is in a disconnected state, while also aligning PTY disconnect messaging with the existing Auto Reconnect setting and new localized guidance strings.

Changes:

  • Add a scoped onKeyDown handler so R/r reconnects only the active disconnected terminal tab (ignoring repeats, modifiers, and IME/composition events).
  • Respect the persisted Auto Reconnect setting when the PTY WebSocket closes; when disabled, stop retrying and prompt for manual reconnect.
  • Introduce localized terminal guidance strings for manual reconnect and exhausted auto-reconnect attempts (EN + zh-CN), and add test coverage for the new behaviors.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/components/terminal/terminal-tab-portals.tsx Adds the R/r reconnect key handler gated to active + disconnected terminal tabs.
src/components/pty-terminal.tsx Honors Auto Reconnect on WS close and prints localized manual reconnect guidance when applicable.
src/locales/en.json Adds new ptyTerminal.* strings for reconnect guidance.
src/locales/zh-CN.json Adds Chinese translations for the new reconnect guidance strings.
src/tests/terminal-tab-portals.test.tsx Tests that only the active disconnected tab reconnects on an unmodified R key.
src/tests/pty-terminal-activation.test.tsx Tests that auto-reconnect stops when disabled and manual guidance is printed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: allow pressing R to reconnect from a disconnected terminal

2 participants