mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: make group order of files from flat view stable on select (#3712)
This commit is contained in:
parent
16aa3cd0fc
commit
8b773a62a5
2 changed files with 3 additions and 4 deletions
|
|
@ -29,7 +29,7 @@ impl Selected {
|
||||||
I: IntoIterator<Item = T>,
|
I: IntoIterator<Item = T>,
|
||||||
T: Into<Url<'a>>,
|
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) {
|
for url in urls.into_iter().map(Into::into) {
|
||||||
if let Some(p) = url.parent() {
|
if let Some(p) = url.parent() {
|
||||||
grouped.entry(p).or_default().push(url);
|
grouped.entry(p).or_default().push(url);
|
||||||
|
|
@ -71,7 +71,6 @@ impl Selected {
|
||||||
urls.len()
|
urls.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn remove<'a>(&mut self, url: impl Into<Url<'a>> + Clone) -> bool {
|
pub fn remove<'a>(&mut self, url: impl Into<Url<'a>> + Clone) -> bool {
|
||||||
self.remove_same([url]) == 1
|
self.remove_same([url]) == 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,11 @@ impl FilesSorter {
|
||||||
}),
|
}),
|
||||||
SortBy::Alphabetical => items.sort_unstable_by(|a, b| {
|
SortBy::Alphabetical => items.sort_unstable_by(|a, b| {
|
||||||
promote!(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| {
|
SortBy::Natural => items.sort_unstable_by(|a, b| {
|
||||||
promote!(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| {
|
SortBy::Size => items.sort_unstable_by(|a, b| {
|
||||||
promote!(a, b);
|
promote!(a, b);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue