diff options
author | Canop <cano.petrole@gmail.com> | 2020-07-31 14:02:32 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-07-31 14:02:32 +0200 |
commit | 66b600526084efeb4c995b0c7c2af28158c8ae11 (patch) | |
tree | e07b3fc9735817508cfcd8889479b09fef7f7774 /src/browser/browser_state.rs | |
parent | 9ef466e27250f238cbd11e88d1a08c5fe4bec864 (diff) |
rewrite the status generation
They better adapt to the various cases.
Fix #261
Diffstat (limited to 'src/browser/browser_state.rs')
-rw-r--r-- | src/browser/browser_state.rs | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/browser/browser_state.rs b/src/browser/browser_state.rs index eca95ae..187d962 100644 --- a/src/browser/browser_state.rs +++ b/src/browser/browser_state.rs @@ -382,7 +382,6 @@ impl AppState for BrowserState { Internal::panel_left => { if cc.areas.is_first() { if cc.preview.is_some() && cc.areas.nb_pos == 2 { - //if cc.preview.is_some() && self.selected_path().is_file() { AppStateCmdResult::ClosePanel { validate_purpose: false, id: cc.preview, @@ -597,26 +596,20 @@ impl AppState for BrowserState { }) } - fn no_verb_status(&self, has_pattern: bool, con: &AppContext) -> Status { - if self.displayed_tree().selection == 0 { - if has_pattern { - con.standard_status.root_pat.clone() - } else { - con.standard_status.root_no_pat.clone() - } - } else if self.selection_type() == SelectionType::Directory { - if has_pattern { - con.standard_status.dir_pat.clone() - } else { - con.standard_status.dir_no_pat.clone() - } - } else { - if has_pattern { - con.standard_status.file_pat.clone() - } else { - con.standard_status.file_no_pat.clone() - } - } + fn no_verb_status( + &self, + has_previous_state: bool, + con: &AppContext, + ) -> Status { + let mut ssb = con.standard_status.builder( + AppStateType::Tree, + self.selection(), + ); + ssb.has_previous_state = has_previous_state; + ssb.is_filtered = self.filtered_tree.is_some(); + ssb.has_removed_pattern = false; + ssb.on_tree_root = self.displayed_tree().selection == 0; + ssb.status() } /// do some work, totally or partially, if there's some to do. |