Skip to content

fix: scope editor files and tabs per worktree#68

Merged
AmethystLiang merged 1 commit intomainfrom
AmethystLiang/fixSourceControlFile
Mar 23, 2026
Merged

fix: scope editor files and tabs per worktree#68
AmethystLiang merged 1 commit intomainfrom
AmethystLiang/fixSourceControlFile

Conversation

@AmethystLiang
Copy link
Copy Markdown
Contributor

Problem

Editor files and tab state were shared globally across all worktrees. When switching between worktrees, files from other worktrees would appear in the tab bar, tab counts were incorrect, and the active file/tab type was not restored per-worktree. Closing a worktree also didn't clean up its associated editor files.

Solution

  • Filter editor files by active worktree in the Terminal component so only relevant files appear in the tab bar and tab count
  • Add per-worktree tracking of active file and tab type (activeFileIdByWorktree, activeTabTypeByWorktree) in the editor store
  • Restore per-worktree editor state when switching worktrees via setActiveWorktree, with fallback to another open file if the remembered file was closed
  • Clean up editor files and per-worktree state when a worktree is removed
  • Scope closeFile and closeAllFiles to the active worktree
  • Use type instead of interface for OpenFile and EditorSlice (lint fix)

🤖 Generated with Claude Code

@AmethystLiang AmethystLiang merged commit 2163c67 into main Mar 23, 2026
@AmethystLiang AmethystLiang deleted the AmethystLiang/fixSourceControlFile branch March 23, 2026 23:45
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