native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #5 from onevcat/fix/canvas-lint-violations

Fix SwiftLint violations in CanvasView

authored by

Wei Wang and committed by
GitHub
c231e6ca 1f4ef914

+16 -18
+16 -18
supacode/Features/Canvas/Views/CanvasView.swift
··· 23 23 24 24 var body: some View { 25 25 CanvasScrollContainer(offset: $canvasOffset, lastOffset: $lastCanvasOffset) { 26 - GeometryReader { geometry in 26 + GeometryReader { _ in 27 27 let activeStates = terminalManager.activeWorktreeStates 28 28 let allCardKeys = collectCardKeys(from: activeStates) 29 - let _ = ensureLayouts(for: allCardKeys) 30 29 31 30 // Background layer: handles canvas pan and tap-to-unfocus. 32 31 Color.clear 32 + .onAppear { ensureLayouts(for: allCardKeys) } 33 + .onChange(of: allCardKeys) { _, newKeys in ensureLayouts(for: newKeys) } 33 34 .contentShape(.rect) 34 35 .accessibilityAddTraits(.isButton) 35 36 .onTapGesture { unfocusAll() } ··· 164 165 165 166 // Build locally, assign once to trigger a single save. 166 167 var layouts = layoutStore.cardLayouts 167 - for (i, key) in unpositioned.enumerated() { 168 + for (offset, key) in unpositioned.enumerated() { 168 169 layouts[key] = CanvasCardLayout( 169 - position: gridPosition(index: positionedCount + i, columns: columns) 170 + position: gridPosition(index: positionedCount + offset, columns: columns) 170 171 ) 171 172 } 172 173 layoutStore.cardLayouts = layouts ··· 314 315 } label: { 315 316 Image(systemName: "square.grid.2x2") 316 317 .font(.body) 318 + .accessibilityLabel("Organize") 317 319 } 318 320 .buttonStyle(.bordered) 319 321 .padding() ··· 358 360 focusedTabID = tabID 359 361 360 362 // Unfocus all surfaces in the previous card's split tree 361 - if let previousTabID, previousTabID != tabID { 362 - for state in states { 363 - if state.surfaceView(for: previousTabID) != nil { 364 - for surface in state.splitTree(for: previousTabID).leaves() { 365 - surface.focusDidChange(false) 366 - } 367 - break 368 - } 363 + if let previousTabID, previousTabID != tabID, 364 + let previousState = states.first(where: { $0.surfaceView(for: previousTabID) != nil }) 365 + { 366 + for surface in previousState.splitTree(for: previousTabID).leaves() { 367 + surface.focusDidChange(false) 369 368 } 370 369 } 371 370 ··· 376 375 private func unfocusAll() { 377 376 guard let previousTabID = focusedTabID else { return } 378 377 focusedTabID = nil 379 - for state in terminalManager.activeWorktreeStates { 380 - if state.surfaceView(for: previousTabID) != nil { 381 - for surface in state.splitTree(for: previousTabID).leaves() { 382 - surface.focusDidChange(false) 383 - } 384 - break 378 + if let state = terminalManager.activeWorktreeStates 379 + .first(where: { $0.surfaceView(for: previousTabID) != nil }) 380 + { 381 + for surface in state.splitTree(for: previousTabID).leaves() { 382 + surface.focusDidChange(false) 385 383 } 386 384 } 387 385 }