Skip to content

Always focus the terminal after worktree navigation#371

Merged
sbertix merged 4 commits into
supabitapp:mainfrom
COCPORN:pr/always-focus-terminal
May 31, 2026
Merged

Always focus the terminal after worktree navigation#371
sbertix merged 4 commits into
supabitapp:mainfrom
COCPORN:pr/always-focus-terminal

Conversation

@COCPORN
Copy link
Copy Markdown
Contributor

@COCPORN COCPORN commented May 30, 2026

What

Focuses the destination terminal whenever you navigate to a worktree outside the command palette: sidebar click / arrow-nav, worktree hotkey slots, next/prev, and history back/forward.

Why

Matches the menu and deeplink paths that already passed focusTerminal: true, honoring the "terminal is the default focus" invariant. Previously a sidebar click left focus floating, so you had to click into the terminal before typing.

Scope

2 files, ~20 lines — flips existing call sites to focusTerminal: true and adds the same focus step to history navigation. No new API; focusTerminal / focusTerminalRequested already exist.

Disclosure

Implemented with AI assistance (Claude Code); reviewed and verified in a real build.

Makes the terminal regain focus whenever you navigate to a worktree outside the
command palette — sidebar click / arrow-nav, worktree hotkey slots, next/prev,
and history back/forward — matching the menu and deeplink paths that already
passed `focusTerminal: true`.

Previously a sidebar selection left focus floating, so every click had to be
followed by a manual click into the terminal to start typing. This honors the
"terminal is the default focus" invariant across all navigation surfaces.

Implemented with AI assistance (Claude Code); reviewed and verified in a real
build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@sbertix sbertix left a comment

Choose a reason for hiding this comment

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

Yeah, I think the historical reasons for having navigation this way no longer hold. And some process (e.g., Claude Code) randomly pull focus to the terminal surface either way, so this is for the best 💪

Thank you 🙇‍♂️

(I feel like the comments are not needed tbh, as they don't really explain the WHY, just the WHAT, but 100% nit)

Comment thread supacode/Features/Repositories/Views/SidebarListView.swift Outdated
Comment thread supacode/Features/Repositories/Reducer/RepositoriesFeature.swift Outdated
Per review on supabitapp#371: the comments narrated the WHAT, not the WHY. The
`focusTerminal: true` call sites and the history-nav focus block are
self-explanatory; removing the prose.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@COCPORN
Copy link
Copy Markdown
Contributor Author

COCPORN commented May 30, 2026

Thanks so much — really glad it's useful! 🙏

Good call on the comments; you're right that they narrated the what rather than the why. Dropped both (latest commit).

And agreed on the rationale — since other processes (Claude Code, etc.) pull focus to the terminal surface anyway, making that the consistent default just matches how it already behaves in practice. 💪

@sbertix sbertix enabled auto-merge (squash) May 30, 2026 22:48
@sbertix sbertix disabled auto-merge May 30, 2026 22:48
@sbertix sbertix enabled auto-merge (squash) May 30, 2026 22:49
@sbertix sbertix disabled auto-merge May 30, 2026 23:06
sbertix added 2 commits May 31, 2026 13:42
Keyboard and history worktree navigation now emit a trailing
focusTerminalRequested row action; the navigation tests didn't
assert it and failed on an unexpected received action.
@sbertix sbertix enabled auto-merge (squash) May 31, 2026 16:10
@sbertix sbertix disabled auto-merge May 31, 2026 16:22
@sbertix sbertix enabled auto-merge (squash) May 31, 2026 16:23
@sbertix sbertix merged commit 65c87e3 into supabitapp:main May 31, 2026
2 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.

3 participants