summaryrefslogtreecommitdiffstats
path: root/src/commands/show_hidden.rs
blob: aabc0000481898733d3a3c51c42c4fbc8e5af1d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;

use super::reload;

pub fn _toggle_hidden(context: &mut JoshutoContext) {
    let opposite = !context.config_t.sort_option.show_hidden;
    context.config_t.sort_option.show_hidden = opposite;

    for tab in context.tab_context_mut().iter_mut() {
        tab.history_mut().depreciate_all_entries();
        if let Some(s) = tab.curr_list_mut() {
            s.depreciate();
        }
    }
}

pub fn toggle_hidden(context: &mut JoshutoContext) -> JoshutoResult<()> {
    _toggle_hidden(context);
    reload::reload_dirlist(context)
}