feat: learn launch suggestions and preserve selection during refresh

This commit is contained in:
2026-10-11 20:52:00 +02:00
parent 01cf6cc8c4
commit e9ac609884
5 changed files with 163 additions and 9 deletions
+3 -2
View File
@@ -12,7 +12,8 @@ public struct Application: Identifiable, Sendable {
}
fileprivate init(canonicalURL: URL, name: String) {
url = canonicalURL
url = canonicalURL.hasDirectoryPath
? canonicalURL : URL(fileURLWithPath: canonicalURL.path, isDirectory: true)
self.name = name
searchableName = folded(name)
searchableCharacters = Array(searchableName)
@@ -137,7 +138,7 @@ private func folded(_ string: String) -> String {
string.folding(options: [.caseInsensitive, .diacriticInsensitive], locale: searchLocale)
}
private func alphabetical(_ lhs: Application, _ rhs: Application) -> Bool {
func alphabetical(_ lhs: Application, _ rhs: Application) -> Bool {
let order = lhs.name.localizedStandardCompare(rhs.name)
if order != .orderedSame { return order == .orderedAscending }
if lhs.name != rhs.name { return lhs.name < rhs.name }