native macOS codings agent orchestrator
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(shelf): refocus terminal after sidebar selection

+20
+20
supacode/Features/Repositories/Views/SidebarListView.swift
··· 67 67 } else { 68 68 sidebarSelections = [.repository(repositoryID)] 69 69 store.send(.selectRepository(repositoryID)) 70 + focusShelfTerminalAfterSidebarInteraction(worktreeID: store.state.selectedTerminalWorktree?.id) 70 71 } 71 72 return 72 73 } ··· 81 82 if let selectedWorktreeID = state.selectedWorktreeID, 82 83 worktreeIDs.contains(selectedWorktreeID) 83 84 { 85 + focusShelfTerminalAfterSidebarInteraction(worktreeID: selectedWorktreeID) 84 86 return 85 87 } 86 88 let nextPrimarySelection = 87 89 hotkeyRows.map(\.id).first(where: worktreeIDs.contains) 88 90 ?? worktreeIDs.first 89 91 store.send(.selectWorktree(nextPrimarySelection, focusTerminal: true)) 92 + focusShelfTerminalAfterSidebarInteraction(worktreeID: nextPrimarySelection) 90 93 } 91 94 ) 92 95 let repositoriesByID = Dictionary(uniqueKeysWithValues: store.repositories.map { ($0.id, $0) }) ··· 221 224 ) 222 225 ) 223 226 .focused($isSidebarFocused) 227 + .onChange(of: isSidebarFocused) { _, isFocused in 228 + guard isFocused else { return } 229 + focusShelfTerminalAfterSidebarInteraction(worktreeID: store.state.selectedTerminalWorktree?.id) 230 + } 224 231 .task(id: pendingSidebarReveal?.id) { 225 232 await revealPendingSidebarWorktree(pendingSidebarReveal, with: scrollProxy) 226 233 } 227 234 } // ScrollViewReader 235 + } 236 + 237 + private func focusShelfTerminalAfterSidebarInteraction(worktreeID: Worktree.ID?) { 238 + guard store.state.isShelfActive, let worktreeID else { return } 239 + Task { @MainActor [terminalManager] in 240 + for _ in 0..<4 { 241 + await Task.yield() 242 + if let terminalState = terminalManager.stateIfExists(for: worktreeID) { 243 + terminalState.focusSelectedTab() 244 + return 245 + } 246 + } 247 + } 228 248 } 229 249 230 250 @MainActor