File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,8 @@ extension AppListModel {
223223
224224 for app in apps {
225225 var key = app. name
226+ . trimmingCharacters ( in: . controlCharacters)
227+ . trimmingCharacters ( in: . whitespacesAndNewlines)
226228 . applyingTransform ( . stripCombiningMarks, reverse: false ) ?
227229 . applyingTransform ( . toLatin, reverse: false ) ?
228230 . applyingTransform ( . stripDiacritics, reverse: false ) ?
@@ -243,7 +245,17 @@ extension AppListModel {
243245 groupedApps [ key] ? . append ( app)
244246 }
245247
246- groupedApps. sort { $0. key < $1. key }
248+ groupedApps. sort { app1, app2 in
249+ if let c1 = app1. key. first,
250+ let c2 = app2. key. first,
251+ let idx1 = allowedCharacters. firstIndex ( of: c1) ,
252+ let idx2 = allowedCharacters. firstIndex ( of: c2)
253+ {
254+ return idx1 < idx2
255+ }
256+ return app1. key < app2. key
257+ }
258+
247259 return groupedApps
248260 }
249261}
You can’t perform that action at this time.
0 commit comments