Skip to content

Fix worktree switch tab order, focus restoration, and remap Cmd+J to editor terminal#81

Merged
amandal0903 merged 3 commits intoreleasefrom
tab-order-on-switch
Apr 6, 2026
Merged

Fix worktree switch tab order, focus restoration, and remap Cmd+J to editor terminal#81
amandal0903 merged 3 commits intoreleasefrom
tab-order-on-switch

Conversation

@amandal0903
Copy link
Copy Markdown
Collaborator

Summary

  • Tab order preservation: Terminal tabs are now restored to their original interleaved positions (e.g. [E1, T1, T2, E2]) when switching back to a worktree, instead of being appended at the end
  • Focus restoration: The previously-active editor per group is saved before backgrounding and restored after re-showing terminals, so switching back doesn't leave an unintended terminal focused
  • Cmd+J remapped: Moved the Cmd+J keybinding from toggling the bottom panel to "Create New Terminal in Editor Area"
  • Logging cleanup: Replaced leftover console.warn debug statements with proper _logService.trace() calls; added duplicate Stop event deduplication
  • Tests: Added comprehensive test suite (~310 lines) covering tab reordering and active editor focus restoration across worktree switches

Avijit Mandal added 3 commits April 7, 2026 03:56
Preserve the original interleaved editor/terminal tab order when
switching between worktrees. Previously, Phase 2 terminal restore
appended terminals at the end (e.g. [E1, E2, T1, T2] instead of
[E1, T1, T2, E2]) and the last terminal stole focus.

- Add tabIndex to ITerminalOwnership; snapshot in Phase 1 alongside
  groupIndex so each terminal's tab position is recorded before
  backgrounding
- After Phase 2 shows terminals, reorder them to their saved tabIndex
  via moveEditor to restore original interleaved positions
- Save per-group active editor URI in Phase 1; restore focus in Phase 2
  after terminals are re-shown to prevent focus theft
- Replace console.warn debug leftovers with logService.trace
- Skip duplicate Stop notifications (self-transition guard)
- Fix test mocks: add shellLaunchConfig, capabilities, getSessionState
@amandal0903 amandal0903 merged commit dffa65b into release Apr 6, 2026
amandal0903 added a commit that referenced this pull request Apr 7, 2026
…editor terminal (#81)

* Fix worktree switch tab order and focus restoration

Preserve the original interleaved editor/terminal tab order when
switching between worktrees. Previously, Phase 2 terminal restore
appended terminals at the end (e.g. [E1, E2, T1, T2] instead of
[E1, T1, T2, E2]) and the last terminal stole focus.

- Add tabIndex to ITerminalOwnership; snapshot in Phase 1 alongside
  groupIndex so each terminal's tab position is recorded before
  backgrounding
- After Phase 2 shows terminals, reorder them to their saved tabIndex
  via moveEditor to restore original interleaved positions
- Save per-group active editor URI in Phase 1; restore focus in Phase 2
  after terminals are re-shown to prevent focus theft
- Replace console.warn debug leftovers with logService.trace
- Skip duplicate Stop notifications (self-transition guard)
- Fix test mocks: add shellLaunchConfig, capabilities, getSessionState

* Bump version to v0.2.8

* Remap Cmd+J to open terminal in editor area instead of toggling bottom panel
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