From 020976bf8859324f2cd653988988b08b60ae300c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 21 Jun 2025 06:42:31 -0700 Subject: [PATCH] macos: address some feedback --- .../App Intents/Entities/TerminalEntity.swift | 6 +++--- .../Features/App Intents/GhosttyIntentError.swift | 6 +++--- .../Sources/Helpers/Extensions/Array+Extension.swift | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/macos/Sources/Features/App Intents/Entities/TerminalEntity.swift b/macos/Sources/Features/App Intents/Entities/TerminalEntity.swift index 1fb69f1f8..e29fbba3f 100644 --- a/macos/Sources/Features/App Intents/Entities/TerminalEntity.swift +++ b/macos/Sources/Features/App Intents/Entities/TerminalEntity.swift @@ -130,10 +130,10 @@ struct TerminalQuery: EntityStringQuery, EnumerableEntityQuery { let controllers = NSApp.windows.compactMap { $0.windowController as? BaseTerminalController } - + // Get all our surfaces - return controllers.reduce([]) { result, c in - result + (c.surfaceTree.root?.leaves() ?? []) + return controllers.flatMap { + $0.surfaceTree.root?.leaves() ?? [] } } } diff --git a/macos/Sources/Features/App Intents/GhosttyIntentError.swift b/macos/Sources/Features/App Intents/GhosttyIntentError.swift index 635250f72..c52b7a52e 100644 --- a/macos/Sources/Features/App Intents/GhosttyIntentError.swift +++ b/macos/Sources/Features/App Intents/GhosttyIntentError.swift @@ -5,9 +5,9 @@ enum GhosttyIntentError: Error, CustomLocalizedStringResourceConvertible { var localizedStringResource: LocalizedStringResource { switch self { - case .appUnavailable: return "The Ghostty app isn't properly initialized." - case .surfaceNotFound: return "The terminal no longer exists." - case .permissionDenied: return "Ghostty doesn't allow Shortcuts." + case .appUnavailable: "The Ghostty app isn't properly initialized." + case .surfaceNotFound: "The terminal no longer exists." + case .permissionDenied: "Ghostty doesn't allow Shortcuts." } } } diff --git a/macos/Sources/Helpers/Extensions/Array+Extension.swift b/macos/Sources/Helpers/Extensions/Array+Extension.swift index fac340472..4e8e39918 100644 --- a/macos/Sources/Helpers/Extensions/Array+Extension.swift +++ b/macos/Sources/Helpers/Extensions/Array+Extension.swift @@ -34,12 +34,12 @@ extension Array where Element == String { func helper(index: Int, accumulated: [UnsafePointer?], body: ([UnsafePointer?]) throws -> T) rethrows -> T { if index == count { return try body(accumulated) - } else { - return try self[index].withCString { cStr in - var newAccumulated = accumulated - newAccumulated.append(cStr) - return try helper(index: index + 1, accumulated: newAccumulated, body: body) - } + } + + return try self[index].withCString { cStr in + var newAccumulated = accumulated + newAccumulated.append(cStr) + return try helper(index: index + 1, accumulated: newAccumulated, body: body) } } -- 2.51.2