Sort naturally
This commit is contained in:
parent
3888282687
commit
2d0a0059d3
3 changed files with 18 additions and 1 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
|
@ -199,6 +199,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "any_ascii"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "apply"
|
name = "apply"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
@ -945,6 +951,7 @@ dependencies = [
|
||||||
"i18n-embed",
|
"i18n-embed",
|
||||||
"i18n-embed-fl",
|
"i18n-embed-fl",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
"lexical-sort",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"log",
|
"log",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
|
|
@ -2706,6 +2713,15 @@ dependencies = [
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lexical-sort"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c09e4591611e231daf4d4c685a66cb0410cc1e502027a20ae55f2bb9e997207a"
|
||||||
|
dependencies = [
|
||||||
|
"any_ascii",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.151"
|
version = "0.2.151"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ edition = "2021"
|
||||||
dirs = "5.0.1"
|
dirs = "5.0.1"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
|
lexical-sort = "0.3.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = { version = "1", features = ["serde_derive"] }
|
serde = { version = "1", features = ["serde_derive"] }
|
||||||
tokio = { version = "1" }
|
tokio = { version = "1" }
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ pub fn rescan(tab_path: PathBuf) -> Vec<Item> {
|
||||||
items.sort_by(|a, b| match (a.is_dir, b.is_dir) {
|
items.sort_by(|a, b| match (a.is_dir, b.is_dir) {
|
||||||
(true, false) => Ordering::Less,
|
(true, false) => Ordering::Less,
|
||||||
(false, true) => Ordering::Greater,
|
(false, true) => Ordering::Greater,
|
||||||
_ => a.name.cmp(&b.name),
|
_ => lexical_sort::natural_lexical_cmp(&a.name, &b.name),
|
||||||
});
|
});
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue