pub struct Status {
pub tabs: [Tab; 2],
pub index: usize,
pub flagged: Flagged,
pub marks: Marks,
pub colors: ColorCache,
pub dual_pane: bool,
pub system_info: System,
pub display_full: bool,
pub opener: Opener,
pub help: String,
pub trash: Trash,
/* private fields */
}Expand description
Holds every mutable parameter of the application itself, except for
the “display” information.
It holds 2 tabs (left & right), even if only one can be displayed sometimes.
It knows which tab is selected, which files are flagged,
which jump target is selected, a cache of normal file colors,
if we have to display one or two tabs and if all details are shown or only
the filename.
Mutation of this struct are mostly done externally, by the event crate :
crate::event_exec.
Fields§
§tabs: [Tab; 2]Vector of Tab, each of them are displayed in a separate tab.
index: usizeIndex of the current selected tab
flagged: FlaggedThe flagged files
marks: MarksMarks allows you to jump to a save mark
colors: ColorCacheColors for extension
dual_pane: booldo we display one or two tabs ?
system_info: System§display_full: booldo we display all info or only the filenames ?
opener: OpenerThe opener used by the application.
help: StringThe help string.
trash: TrashThe trash
Implementations§
source§impl Status
impl Status
sourcepub const MAX_PERMISSIONS: u32 = 511u32
pub const MAX_PERMISSIONS: u32 = 511u32
Max valid permission number, ie 0o777.
sourcepub fn new(
args: Args,
config: Config,
height: usize,
term: Arc<Term>,
help: String
) -> FmResult<Self>
pub fn new(
args: Args,
config: Config,
height: usize,
term: Arc<Term>,
help: String
) -> FmResult<Self>
Creates a new status for the application. It requires most of the information (arguments, configuration, height of the terminal, the formated help string).
sourcepub fn selected_non_mut(&self) -> &Tab
pub fn selected_non_mut(&self) -> &Tab
Returns a non mutable reference to the selected tab.
sourcepub fn reset_tabs_view(&mut self) -> FmResult<()>
pub fn reset_tabs_view(&mut self) -> FmResult<()>
Reset the view of every tab.
sourcepub fn toggle_flag_on_path(&mut self, path: &Path)
pub fn toggle_flag_on_path(&mut self, path: &Path)
Toggle the flagged attribute of a path.
sourcepub fn fill_tabs_with_skim(&mut self) -> FmResult<()>
pub fn fill_tabs_with_skim(&mut self) -> FmResult<()>
Replace the tab content with what was returned by skim. It calls skim read its output, then replace the tab itself.
sourcepub fn filtered_flagged_files(&self) -> Vec<&Path> ⓘ
pub fn filtered_flagged_files(&self) -> Vec<&Path> ⓘ
Returns a vector of path of files which are both flagged and in current directory. It’s necessary since the user may have flagged files OUTSIDE of current directory before calling Bulkrename. It may be confusing since the same filename can be used in different places.
sourcepub fn cut_or_copy_flagged_files(
&mut self,
cut_or_copy: CopyMove
) -> FmResult<()>
pub fn cut_or_copy_flagged_files(
&mut self,
cut_or_copy: CopyMove
) -> FmResult<()>
Execute a move or a copy of the flagged files to current directory. A progress bar is displayed (invisible for small files) and a notification is sent every time, even for 0 bytes files…
sourcepub fn clear_flags_and_reset_view(&mut self) -> FmResult<()>
pub fn clear_flags_and_reset_view(&mut self) -> FmResult<()>
Empty the flagged files, reset the view of every tab.
sourcepub fn set_permissions<P>(path: P, permissions: u32) -> FmResult<()>where
P: AsRef<Path>,
pub fn set_permissions<P>(path: P, permissions: u32) -> FmResult<()>where
P: AsRef<Path>,
Set the permissions of the flagged files according to a given permission. If the permission are invalid or if the user can’t edit them, it may fail.
sourcepub fn select_from_regex(&mut self) -> Result<(), Error>
pub fn select_from_regex(&mut self) -> Result<(), Error>
Flag every file matching a typed regex.
sourcepub fn select_tab(&mut self, index: usize) -> FmResult<()>
pub fn select_tab(&mut self, index: usize) -> FmResult<()>
Select a tab according to its index. It’s deprecated and is left mostly because I’m not sure I want tabs & panes… and I haven’t fully decided yet. Since I’m lazy and don’t want to write it twice, it’s left here.
sourcepub fn set_dual_pane(&mut self, dual_pane: bool)
pub fn set_dual_pane(&mut self, dual_pane: bool)
Set dual pane mode to true or false.
sourcepub fn refresh_disks(&mut self)
pub fn refresh_disks(&mut self)
Refresh every disk information. It also refreshes the disk list, which is usefull to detect removable medias. It may be very slow… There’s surelly a better way, like doing it only once in a while or on demand.
sourcepub fn disk_spaces_per_tab(&self) -> (String, String)
pub fn disk_spaces_per_tab(&self) -> (String, String)
Returns a pair of disk spaces for both tab.
sourcepub fn term_size(&self) -> FmResult<(usize, usize)>
pub fn term_size(&self) -> FmResult<(usize, usize)>
Returns the sice of the terminal (width, height)
sourcepub fn selected_path_str(&self) -> &str
pub fn selected_path_str(&self) -> &str
Returns a string representing the current path in the selected tab.
sourcepub fn refresh_users(&mut self) -> FmResult<()>
pub fn refresh_users(&mut self) -> FmResult<()>
Refresh the existing users.