Skip to content

feat(desktop): toggle the last two threads with Ctrl+Tab - #215

Merged
pandec merged 3 commits into
devfrom
t3code/desktop-previous-thread-shortcut
Sep 22, 2026
Merged

pandec merged 3 commits into
devfrom
t3code/desktop-previous-thread-shortcut

Conversation

@pandec

@pandec pandec commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Desktop users can now press Ctrl+Tab to toggle between the current and previously viewed thread. The pair follows the focused split pane and can span projects and environments. Opening another thread replaces the older entry; an unsent draft can return to the last viewed thread without entering the pair.

Adds the rebindable thread.lastVisited command with a desktop-only default. The shortcut consumes both the press and release before composer or terminal input, ignores repeats, and validates the destination before opening it. Embedded browser pages keep their keyboard input. README and shortcut documentation describe the behavior.

Validation:

  • vp check passed with the same existing warnings as the baseline.
  • vp run typecheck passed.
  • 192 focused shortcut, keybinding, and split-pane tests passed.
  • An optional web unused-export scan reports existing issues outside the changed code.
  • No integrated desktop session was launched. Electron keyboard delivery remains to be checked in the running app.

Models: GPT-6 and Claude Fable 5.1, with parallel reviews by GPT-5.6 Sol and Claude Opus 5. Harness: Codex.

Summary by CodeRabbit

  • New Features

    • Added a desktop shortcut, Ctrl+Tab (Control on macOS), to toggle between the current and previously viewed thread.
    • Works across projects and environments, while typing, in split view, and from embedded browser pages.
    • Thread history persists for the current app session and skips unavailable or archived threads.
    • Added a setting under Settings → Keybindings → Thread: Last Visited.
  • Documentation

    • Documented the new shortcut and its behavior.

@pandec
pandec marked this pull request as ready for review September 22, 2026 09:14
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pandec/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 3a9448f0-9afd-4602-866d-b70797c99e19

📥 Commits

Reviewing files that changed from the base of the PR and between e5028ed and 9a28014.

📒 Files selected for processing (7)
  • README.md
  • apps/web/src/routes/_chat.tsx
  • apps/web/src/threadLastVisited.test.ts
  • apps/web/src/threadLastVisited.ts
  • docs/user/keybindings.md
  • packages/contracts/src/keybindings.ts
  • packages/shared/src/keybindings.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The desktop app adds a Ctrl+Tab shortcut for switching between the current and previously visited thread. It tracks two distinct session-local threads, filters unavailable targets, integrates capture-phase event handling, and documents the new keybinding.

Changes

Last-visited thread navigation

Layer / File(s) Summary
Command contract and binding
packages/contracts/src/keybindings.ts, packages/shared/src/keybindings.ts, docs/user/keybindings.md, README.md
The thread.lastVisited command and desktop ctrl+tab binding are added. The documentation describes shortcut behavior and configuration.
Thread history and shortcut controller
apps/web/src/threadLastVisited.ts
Session-local history stores distinct thread references. The shortcut controller handles desktop keydown and keyup events, blocked states, repeats, unavailable targets, and pending releases.
Chat route integration and validation
apps/web/src/routes/_chat.tsx, apps/web/src/threadLastVisited.test.ts
The chat route records focused threads, resolves openable targets, registers capture-phase listeners, and opens the selected thread. Tests cover history, event handling, blocked states, repeats, and controller replacement.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Desktop as Desktop key event
  participant ChatRoute as Chat route
  participant History as threadVisitHistory
  participant ThreadPane as openThreadInActivePane
  Desktop->>ChatRoute: Ctrl+Tab keydown
  ChatRoute->>History: Resolve previous openable thread
  History-->>ChatRoute: Return target or null
  ChatRoute->>ThreadPane: Open resolved thread
  Desktop->>ChatRoute: Matching keyup
  ChatRoute-->>Desktop: Consume release
Loading

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 9a280

The desktop shortcut adds session-local thread toggling with unavailable targets filtered out. The change is ready to merge with normal checks.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: desktop users can toggle between the last two threads with Ctrl+Tab.
Description check ✅ Passed The description clearly explains the feature, behavior, implementation scope, documentation updates, and validation results. The template checklist and explicit UI Changes heading are omitted, but the…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pandec
pandec merged commit d8e4f6f into dev Sep 22, 2026
3 checks passed
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.

1 participant