fix: make group order of files from flat view stable on select (#3712)

This commit is contained in:
三咲雅 misaki masa 2026-02-23 19:01:04 +08:00 committed by GitHub
parent 16aa3cd0fc
commit 8b773a62a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -29,7 +29,7 @@ impl Selected {
I: IntoIterator<Item = T>,
T: Into<Url<'a>>,
{
let mut grouped: HashMap<_, Vec<_>> = Default::default();
let mut grouped: IndexMap<_, Vec<_>> = Default::default();
for url in urls.into_iter().map(Into::into) {
if let Some(p) = url.parent() {
grouped.entry(p).or_default().push(url);
@ -71,7 +71,6 @@ impl Selected {
urls.len()
}
#[inline]
pub fn remove<'a>(&mut self, url: impl Into<Url<'a>> + Clone) -> bool {
self.remove_same([url]) == 1
}

View file

@ -59,11 +59,11 @@ impl FilesSorter {
}),
SortBy::Alphabetical => items.sort_unstable_by(|a, b| {
promote!(a, b);
self.sort_alphabetically(a, b)
self.fallback(a, b, self.sort_alphabetically(a, b))
}),
SortBy::Natural => items.sort_unstable_by(|a, b| {
promote!(a, b);
self.sort_naturally(a, b)
self.fallback(a, b, self.sort_naturally(a, b))
}),
SortBy::Size => items.sort_unstable_by(|a, b| {
promote!(a, b);