Case-insensitive sorting

This commit is contained in:
macmade
2022-10-26 11:46:55 +02:00
parent 0e3b87363a
commit baa24185c5
2 changed files with 2 additions and 2 deletions

View File

@@ -354,7 +354,7 @@ class ApplicationDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate
self.sensorViewControllers = controllers
self.sensorsMenu.items = items.sorted
{
$0.title.compare( $1.title, options: .numeric, range: nil, locale: nil ) == .orderedAscending
$0.title.compare( $1.title, options: [ .numeric, .caseInsensitive ], range: nil, locale: nil ) == .orderedAscending
}
}

View File

@@ -55,7 +55,7 @@ public class SelectSensorsWindowController: NSWindowController, NSTableViewDeleg
self.arrayController.sortDescriptors =
[
NSSortDescriptor( key: "name", ascending: true ),
NSSortDescriptor( key: "name", ascending: true, selector: #selector( NSString.localizedCaseInsensitiveCompare( _: ) ) ),
]
self.windowOpenObserver = NotificationCenter.default.addObserver( forName: NSWindow.didBecomeKeyNotification, object: self.window, queue: nil )