macos: address some feedback

This commit is contained in:
Mitchell Hashimoto
2025-06-21 06:42:31 -07:00
parent e4c13cdba8
commit 020976bf88
3 changed files with 12 additions and 12 deletions

View File

@@ -132,8 +132,8 @@ struct TerminalQuery: EntityStringQuery, EnumerableEntityQuery {
} }
// Get all our surfaces // Get all our surfaces
return controllers.reduce([]) { result, c in return controllers.flatMap {
result + (c.surfaceTree.root?.leaves() ?? []) $0.surfaceTree.root?.leaves() ?? []
} }
} }
} }

View File

@@ -5,9 +5,9 @@ enum GhosttyIntentError: Error, CustomLocalizedStringResourceConvertible {
var localizedStringResource: LocalizedStringResource { var localizedStringResource: LocalizedStringResource {
switch self { switch self {
case .appUnavailable: return "The Ghostty app isn't properly initialized." case .appUnavailable: "The Ghostty app isn't properly initialized."
case .surfaceNotFound: return "The terminal no longer exists." case .surfaceNotFound: "The terminal no longer exists."
case .permissionDenied: return "Ghostty doesn't allow Shortcuts." case .permissionDenied: "Ghostty doesn't allow Shortcuts."
} }
} }
} }

View File

@@ -34,12 +34,12 @@ extension Array where Element == String {
func helper(index: Int, accumulated: [UnsafePointer<Int8>?], body: ([UnsafePointer<Int8>?]) throws -> T) rethrows -> T { func helper(index: Int, accumulated: [UnsafePointer<Int8>?], body: ([UnsafePointer<Int8>?]) throws -> T) rethrows -> T {
if index == count { if index == count {
return try body(accumulated) return try body(accumulated)
} else { }
return try self[index].withCString { cStr in
var newAccumulated = accumulated return try self[index].withCString { cStr in
newAccumulated.append(cStr) var newAccumulated = accumulated
return try helper(index: index + 1, accumulated: newAccumulated, body: body) newAccumulated.append(cStr)
} return try helper(index: index + 1, accumulated: newAccumulated, body: body)
} }
} }