mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-05 20:37:52 +00:00
Fix --sort=ext
The logic of the previous version wasn't correct. Also, presuming natural ordering of full filenames is still reasonable when the extensions are identical.
This commit is contained in:
parent
ae39d0f8a7
commit
ee20c5d8bb
@ -5,7 +5,6 @@ use column::Column::*;
|
||||
use output::{Grid, Details};
|
||||
use term::dimensions;
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt;
|
||||
|
||||
@ -118,13 +117,9 @@ impl FileFilter {
|
||||
SortField::Name => files.sort_by(|a, b| natord::compare(&*a.name, &*b.name)),
|
||||
SortField::Size => files.sort_by(|a, b| a.stat.size.cmp(&b.stat.size)),
|
||||
SortField::FileInode => files.sort_by(|a, b| a.stat.unstable.inode.cmp(&b.stat.unstable.inode)),
|
||||
SortField::Extension => files.sort_by(|a, b| {
|
||||
if a.ext.cmp(&b.ext) == Ordering::Equal {
|
||||
Ordering::Equal
|
||||
}
|
||||
else {
|
||||
a.name.to_ascii_lowercase().cmp(&b.name.to_ascii_lowercase())
|
||||
}
|
||||
SortField::Extension => files.sort_by(|a, b| match a.ext.cmp(&b.ext) {
|
||||
Ordering::Equal => natord::compare(&*a.name, &*b.name),
|
||||
order => order
|
||||
}),
|
||||
SortField::ModifiedDate => files.sort_by(|a, b| a.stat.modified.cmp(&b.stat.modified)),
|
||||
SortField::AccessedDate => files.sort_by(|a, b| a.stat.accessed.cmp(&b.stat.accessed)),
|
||||
|
Loading…
Reference in New Issue
Block a user