Status bar improvements: 'Show hidden files' in status bar; Status bar is has now been splitted into two, one for each explorer tab

This commit is contained in:
veeso
2021-06-16 13:57:11 +02:00
parent 56a200499e
commit efad2b96db
5 changed files with 110 additions and 29 deletions

View File

@@ -306,6 +306,13 @@ impl FileExplorer {
pub fn toggle_hidden_files(&mut self) {
self.opts.toggle(ExplorerOpts::SHOW_HIDDEN_FILES);
}
/// ### hidden_files_visible
///
/// Returns whether hidden files are visible
pub fn hidden_files_visible(&self) -> bool {
self.opts.intersects(ExplorerOpts::SHOW_HIDDEN_FILES)
}
}
// Traits
@@ -411,6 +418,7 @@ mod tests {
let mut explorer: FileExplorer = FileExplorer::default();
// Don't show hidden files
explorer.opts.remove(ExplorerOpts::SHOW_HIDDEN_FILES);
assert_eq!(explorer.hidden_files_visible(), false);
// Create files
explorer.set_files(vec![
make_fs_entry("README.md", false),
@@ -434,6 +442,7 @@ mod tests {
assert_eq!(explorer.iter_files().count(), 4);
// Toggle hidden
explorer.toggle_hidden_files();
assert_eq!(explorer.hidden_files_visible(), true);
assert_eq!(explorer.iter_files().count(), 6); // All files are returned now
}