native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #54 from onevcat/fix/canvas-cmdw-close-surface

Restore Cmd-W handling in canvas

authored by

Wei Wang and committed by
GitHub
db6f78c0 b4a08c3e

+17 -2
+17 -2
supacode/Features/Repositories/Views/WorktreeDetailView.swift
··· 112 112 } 113 113 } 114 114 let actions = makeFocusedActions( 115 + repositories: repositories, 115 116 hasActiveWorktree: hasActiveTerminalTarget, 116 117 runScriptEnabled: runScriptEnabled, 117 118 runScriptIsRunning: runScriptIsRunning ··· 245 246 } 246 247 247 248 private func makeFocusedActions( 249 + repositories: RepositoriesFeature.State, 248 250 hasActiveWorktree: Bool, 249 251 runScriptEnabled: Bool, 250 252 runScriptIsRunning: Bool ··· 252 254 func action(_ appAction: AppFeature.Action) -> (() -> Void)? { 253 255 hasActiveWorktree ? { store.send(appAction) } : nil 254 256 } 257 + 258 + func canvasAction(_ perform: @escaping (WorktreeTerminalState) -> Bool) -> (() -> Void)? { 259 + guard repositories.isShowingCanvas else { return nil } 260 + return { 261 + guard let worktreeID = terminalManager.canvasFocusedWorktreeID, 262 + let state = terminalManager.stateIfExists(for: worktreeID) 263 + else { 264 + return 265 + } 266 + _ = perform(state) 267 + } 268 + } 269 + 255 270 return FocusedActions( 256 271 openSelectedWorktree: action(.openSelectedWorktree), 257 272 newTerminal: action(.newTerminal), 258 - closeTab: action(.closeTab), 259 - closeSurface: action(.closeSurface), 273 + closeTab: canvasAction { $0.closeFocusedTab() } ?? action(.closeTab), 274 + closeSurface: canvasAction { $0.closeFocusedSurface() } ?? action(.closeSurface), 260 275 startSearch: action(.startSearch), 261 276 searchSelection: action(.searchSelection), 262 277 navigateSearchNext: action(.navigateSearchNext),