Struct broot::app::StandardStatus
source · pub struct StandardStatus {
pub all_files_hidden: Option<String>,
pub all_files_git_ignored: Option<String>,
/* private fields */
}
Expand description
All the precomputed status which don’t involve a verb
Fields§
§all_files_git_ignored: Option<String>
Implementations§
source§impl StandardStatus
impl StandardStatus
sourcepub fn new(verb_store: &VerbStore) -> Self
pub fn new(verb_store: &VerbStore) -> Self
Examples found in repository?
src/app/app_context.rs (line 102)
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
pub fn from(
launch_args: Args,
verb_store: VerbStore,
config: &Conf,
) -> Result<Self, ProgramError> {
let config_paths = config.files.clone();
let standard_status = StandardStatus::new(&verb_store);
let true_colors = if let Some(value) = config.true_colors {
value
} else {
are_true_colors_available()
};
let icons = config.icon_theme.as_ref()
.and_then(|itn| icon_plugin(itn));
let special_paths = config.special_paths
.iter()
.map(|(k, v)| SpecialPath::new(k.clone(), *v))
.collect();
let search_modes = config
.search_modes
.as_ref()
.map(|map| map.try_into())
.transpose()?
.unwrap_or_default();
let ext_colors = ExtColorMap::try_from(&config.ext_colors)
.map_err(ConfError::from)?;
let file_sum_threads_count = config.file_sum_threads_count
.unwrap_or(file_sum::DEFAULT_THREAD_COUNT);
if file_sum_threads_count < 1 || file_sum_threads_count > 50 {
return Err(ConfError::InvalidThreadsCount{ count: file_sum_threads_count }.into());
}
let max_panels_count = config.max_panels_count
.unwrap_or(2)
.clamp(2, 100);
let capture_mouse = match (config.capture_mouse, config.disable_mouse_capture) {
(Some(b), _) => b, // the new "capture_mouse" argument takes precedence
(_, Some(b)) => !b,
_ => true,
};
let max_staged_count = config.max_staged_count
.unwrap_or(10_000)
.clamp(10, 100_000);
let initial_root = get_root_path(&launch_args)?;
// tree options are built from the default_flags
// found in the config file(s) (if any) then overridden
// by the cli args
let mut initial_tree_options = TreeOptions::default();
initial_tree_options.apply_config(config)?;
initial_tree_options.apply_launch_args(&launch_args);
if launch_args.color == TriBool::No {
initial_tree_options.show_selection_mark = true;
}
let content_search_max_file_size = config.content_search_max_file_size
.map(|u64value| usize::try_from(u64value).unwrap_or(usize::MAX))
.unwrap_or(content_search::DEFAULT_MAX_FILE_SIZE);
Ok(Self {
initial_root,
initial_tree_options,
config_paths,
launch_args,
verb_store,
special_paths,
search_modes,
show_selection_mark: config.show_selection_mark.unwrap_or(false),
ext_colors,
syntax_theme: config.syntax_theme,
standard_status,
true_colors,
icons,
modal: config.modal.unwrap_or(false),
capture_mouse,
max_panels_count,
quit_on_last_cancel: config.quit_on_last_cancel.unwrap_or(false),
file_sum_threads_count,
max_staged_count,
content_search_max_file_size,
})
}
sourcepub fn builder<'s>(
&'s self,
state_type: PanelStateType,
selection: Selection<'s>
) -> StandardStatusBuilder<'s>
pub fn builder<'s>(
&'s self,
state_type: PanelStateType,
selection: Selection<'s>
) -> StandardStatusBuilder<'s>
Examples found in repository?
src/preview/preview_state.rs (lines 294-297)
289 290 291 292 293 294 295 296 297 298 299 300 301 302
fn no_verb_status(
&self,
has_previous_state: bool,
con: &AppContext,
) -> Status {
let mut ssb = con.standard_status.builder(
PanelStateType::Preview,
self.no_opt_selection(),
);
ssb.has_previous_state = has_previous_state;
ssb.is_filtered = self.filtered_preview.is_some();
ssb.has_removed_pattern = self.removed_pattern.is_some();
ssb.status()
}
More examples
src/browser/browser_state.rs (lines 632-635)
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641
fn no_verb_status(
&self,
has_previous_state: bool,
con: &AppContext,
) -> Status {
let tree = self.displayed_tree();
if tree.is_empty() {
if tree.build_report.hidden_count > 0 {
let mut parts = Vec::new();
if let Some(md) = con.standard_status.all_files_hidden.clone() {
parts.push(md);
}
if let Some(md) = con.standard_status.all_files_git_ignored.clone() {
parts.push(md);
}
if !parts.is_empty() {
return Status::from_error(parts.join(". "));
}
}
}
let mut ssb = con.standard_status.builder(
PanelStateType::Tree,
tree.selected_line().as_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 = tree.selection == 0;
ssb.status()
}