Struct broot::browser::BrowserState [−][src]
pub struct BrowserState {
pub tree: Tree,
pub filtered_tree: Option<Tree>,
pub pending_pattern: InputPattern,
pub total_search_required: bool,
// some fields omitted
}
Expand description
An application state dedicated to displaying a tree. It’s the first and main screen of broot.
Fields
tree: Tree
filtered_tree: Option<Tree>
pending_pattern: InputPattern
total_search_required: bool
Implementations
pub fn new(
path: PathBuf,
options: TreeOptions,
screen: Screen,
con: &AppContext,
dam: &Dam
) -> Result<Option<BrowserState>, TreeBuildError>
pub fn new(
path: PathBuf,
options: TreeOptions,
screen: Screen,
con: &AppContext,
dam: &Dam
) -> Result<Option<BrowserState>, TreeBuildError>
build a new tree state if there’s no error and there’s no cancellation.
In case of cancellation return Ok(None)
. If dam is unlimited()
then
this can’t be returned.
return a reference to the currently displayed tree, which is the filtered tree if there’s one, the base tree if not.
return a mutable reference to the currently displayed tree, which is the filtered tree if there’s one, the base tree if not.
pub fn open_selection_stay_in_broot(
&mut self,
screen: Screen,
con: &AppContext,
in_new_panel: bool,
keep_pattern: bool
) -> Result<CmdResult, ProgramError>
pub fn go_to_parent(
&mut self,
screen: Screen,
con: &AppContext,
in_new_panel: bool
) -> CmdResult
Trait Implementations
fn with_new_options(
&mut self,
screen: Screen,
change_options: &dyn Fn(&mut TreeOptions),
in_new_panel: bool,
con: &AppContext
) -> CmdResult
fn with_new_options(
&mut self,
screen: Screen,
change_options: &dyn Fn(&mut TreeOptions),
in_new_panel: bool,
con: &AppContext
) -> CmdResult
build a cmdResult asking for the addition of a new state being a browser state similar to the current one but with different options
fn do_pending_task(
&mut self,
_stage: &Stage,
screen: Screen,
con: &AppContext,
dam: &mut Dam
)
fn do_pending_task(
&mut self,
_stage: &Stage,
screen: Screen,
con: &AppContext,
dam: &mut Dam
)
do some work, totally or partially, if there’s some to do. Stop as soon as the dam asks for interruption
called on start of on_command
fn on_click(
&mut self,
_x: u16,
y: u16,
_screen: Screen,
_con: &AppContext
) -> Result<CmdResult, ProgramError>
fn on_double_click(
&mut self,
_x: u16,
y: u16,
screen: Screen,
con: &AppContext
) -> Result<CmdResult, ProgramError>
fn on_pattern(
&mut self,
pat: InputPattern,
_app_state: &AppState,
_con: &AppContext
) -> Result<CmdResult, ProgramError>
fn on_internal(
&mut self,
w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_internal(
&mut self,
w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
execute the internal with the optional given invocation. Read more
return the status which should be used when there’s no verb edited
return the flags to display
fn on_internal_generic(
&mut self,
_w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
_trigger_type: TriggerType,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_internal_generic(
&mut self,
_w: &mut W,
internal_exec: &InternalExecution,
input_invocation: Option<&VerbInvocation>,
_trigger_type: TriggerType,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
a generic implementation of on_internal which may be called by states when they don’t have a specific behavior to execute Read more
fn unstage(
&self,
app_state: &mut AppState,
cc: &CmdContext<'_>,
_con: &AppContext
) -> CmdResult
fn toggle_stage(
&self,
app_state: &mut AppState,
cc: &CmdContext<'_>,
con: &AppContext
) -> CmdResult
fn execute_verb(
&mut self,
w: &mut W,
verb: &Verb,
invocation: Option<&VerbInvocation>,
trigger_type: TriggerType,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn execute_external(
&mut self,
w: &mut W,
verb: &Verb,
external_execution: &ExternalExecution,
invocation: Option<&VerbInvocation>,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn execute_sequence(
&mut self,
_w: &mut W,
verb: &Verb,
seq_ex: &SequenceExecution,
invocation: Option<&VerbInvocation>,
app_state: &mut AppState,
_cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_command(
&mut self,
w: &mut W,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
fn on_command(
&mut self,
w: &mut W,
app_state: &mut AppState,
cc: &CmdContext<'_>
) -> Result<CmdResult, ProgramError>
change the state, does no rendering
fn open_preview(
&mut self,
prefered_mode: Option<PreviewMode>,
close_if_open: bool,
cc: &CmdContext<'_>
) -> CmdResult
fn open_preview(
&mut self,
prefered_mode: Option<PreviewMode>,
close_if_open: bool,
cc: &CmdContext<'_>
) -> CmdResult
return a cmdresult asking for the opening of a preview