diff options
author | Anas Saeed <saeedanas396@gmail.com> | 2020-10-10 22:28:32 -0700 |
---|---|---|
committer | Anas Saeed <saeedanas396@gmail.com> | 2020-10-10 22:28:32 -0700 |
commit | 25bcdf7cf08e2f79274766739cd723afc302f4c2 (patch) | |
tree | 731eb219905f7378aac90800aaf411ec15505bc8 /src/fs | |
parent | b9d20f20f1669a9df2bf51f5950555f187015c0e (diff) |
Added raw filenames to JoshutoDirEntry to fix sorting bug
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/entry.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fs/entry.rs b/src/fs/entry.rs index c6124b7..f95c2a4 100644 --- a/src/fs/entry.rs +++ b/src/fs/entry.rs @@ -11,6 +11,7 @@ use crate::THEME_T; #[derive(Clone, Debug)] pub struct JoshutoDirEntry { name: String, + raw: String, path: path::PathBuf, pub metadata: JoshutoMetadata, selected: bool, @@ -32,6 +33,8 @@ impl JoshutoDirEntry { } }; + let raw = name.clone(); + let name = if show_icons { let icon = match metadata.file_type { FileType::Directory => DIR_NODE_EXACT_MATCHES @@ -63,6 +66,7 @@ impl JoshutoDirEntry { Ok(Self { name, + raw, path, metadata, selected: false, @@ -74,6 +78,10 @@ impl JoshutoDirEntry { self.name.as_str() } + pub fn raw_file_name(&self) -> &str { + self.raw.as_str() + } + pub fn file_path(&self) -> &path::Path { self.path.as_path() } |