feat: Toggle showing hidden items

`ctrl` + `h` toggles the visibility of hidden files and folders per tab.
The per tab option overrides the global option. So, a user may set
hidden items to be visible by default (global option) but override it
per tab with `ctrl` + `h`.

Currently, per tab options aren't presented anywhere in the UI such as a
menu, so the hotkey is the only way to use this feature for now.
This commit is contained in:
Josh Megnauth 2024-02-11 00:24:35 -05:00 committed by Jeremy Soller
parent 073a9a95ab
commit bc5b46d552
4 changed files with 15 additions and 8 deletions

View file

@ -61,6 +61,7 @@ pub enum Action {
TabPrev,
TabViewGrid,
TabViewList,
ToggleShowHidden,
WindowClose,
WindowNew,
}
@ -91,6 +92,7 @@ impl Action {
Action::TabViewList => {
Message::TabMessage(entity_opt, tab::Message::View(tab::View::List))
}
Action::ToggleShowHidden => Message::TabMessage(None, tab::Message::ToggleShowHidden),
Action::WindowClose => Message::WindowClose,
Action::WindowNew => Message::WindowNew,
}
@ -681,8 +683,7 @@ impl Application for App {
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
if let Some(ref mut items) = tab.items_opt {
for item in items.iter_mut() {
if item.hidden {
//TODO: option to show hidden files
if !tab.config.show_hidden && item.hidden {
continue;
}
item.selected = true;