Add sort by option to config for new tabs

This commit is contained in:
Josh Megnauth 2024-03-14 02:17:27 -04:00 committed by Jeremy Soller
parent a4b38c4983
commit e22c74d721
3 changed files with 51 additions and 2 deletions

View file

@ -27,6 +27,7 @@ use std::{
cell::Cell,
cmp::Ordering,
collections::HashMap,
fmt,
fs::{self, Metadata},
path::PathBuf,
time::{Duration, Instant},
@ -620,11 +621,31 @@ pub enum View {
}
#[derive(Clone, Copy, Debug, Hash, PartialEq, PartialOrd, Ord, Eq, Deserialize, Serialize)]
pub enum HeadingOptions {
Name,
Name = 0,
Modified,
Size,
}
impl fmt::Display for HeadingOptions {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
HeadingOptions::Name => write!(f, "{}", fl!("name")),
HeadingOptions::Modified => write!(f, "{}", fl!("modified")),
HeadingOptions::Size => write!(f, "{}", fl!("size")),
}
}
}
impl HeadingOptions {
pub fn names() -> Vec<String> {
vec![
HeadingOptions::Name.to_string(),
HeadingOptions::Modified.to_string(),
HeadingOptions::Size.to_string(),
]
}
}
#[derive(Clone, Debug)]
pub struct Tab {
//TODO: make more items private