Merge pull request #916 from zed-industries/sort-themes

Sort themes by light/dark first and then alphabetically
This commit is contained in:
Nathan Sobo 2022-04-26 08:18:29 -06:00 committed by GitHub
commit 7c3bdf91d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,12 @@ impl ThemeSelector {
let handle = cx.weak_handle();
let picker = cx.add_view(|cx| Picker::new(handle, cx));
let original_theme = cx.global::<Settings>().theme.clone();
let theme_names = registry.list().collect::<Vec<_>>();
let mut theme_names = registry.list().collect::<Vec<_>>();
theme_names.sort_unstable_by(|a, b| {
a.ends_with("dark")
.cmp(&b.ends_with("dark"))
.then_with(|| a.cmp(&b))
});
let matches = theme_names
.iter()
.map(|name| StringMatch {