pub struct Tab {Show 13 fields
pub display_mode: Display,
pub directory: Directory,
pub tree: Tree,
pub preview: Preview,
pub menu_mode: Menu,
pub window: ContentWindow,
pub height: usize,
pub settings: TabSettings,
pub search: Search,
pub history: History,
pub users: Users,
pub origin_path: Option<PathBuf>,
pub visual: bool,
}Expand description
Holds every thing about the current tab of the application. Most of the mutation is done externally.
Fields§
§display_mode: DisplayKind of display: Preview, Normal, Tree
directory: DirectoryFiles in current path
tree: TreeTree representation of the same path
preview: PreviewLines of the previewed files. Empty if not in preview mode.
The menu currently opened in this tab.
Most of the time is spent in EditMode::Nothing
window: ContentWindowThe indexes of displayed file
height: usizeHeight of the terminal window
settings: TabSettingsInternal & display settings: show hidden files ? sort method filter kind
search: SearchLast searched string
history: HistoryVisited directories
users: UsersUsers & groups
origin_path: Option<PathBuf>Saved path before entering “CD” mode. Used if the cd is canceled
visual: boolImplementations§
Source§impl Tab
impl Tab
Sourcepub fn new(args: &Args, height: usize, users: Users) -> Result<Self>
pub fn new(args: &Args, height: usize, users: Users) -> Result<Self>
Creates a new tab from args and height.
§Description
It reads a path from args, which is defaulted to the starting path.
It explores the path and creates a content.
The path is then selected. If no path was provide from args, the current folder . is selected.
Every other attribute has its default value.
§Errors
it may fail if the path:
- doesn’t exist
- can’t be explored
- has no parent and isn’t a directory (which can’t happen)
Sourcepub fn directory_of_selected(&self) -> Result<&Path>
pub fn directory_of_selected(&self) -> Result<&Path>
Returns the directory owning the selected file. In Tree mode, it’s the current directory if the selected node is a directory, its parent otherwise. In normal mode it’s the current working directory.
Sourcepub fn current_path(&self) -> &Path
pub fn current_path(&self) -> &Path
Current path of this tab in directory display mode.
Sourcepub fn current_file(&self) -> Result<FileInfo>
pub fn current_file(&self) -> Result<FileInfo>
Fileinfo of the selected element.
Sourcepub fn current_file_string(&self) -> Result<String>
pub fn current_file_string(&self) -> Result<String>
Path of the currently selected file.
Returns true if the current mode requires 2 windows. Only Tree, Normal & Preview doesn’t require 2 windows.
Sourcepub fn directory_str(&self) -> String
pub fn directory_str(&self) -> String
Returns a string of the current directory path.
Sourcepub fn refresh_params(&mut self)
pub fn refresh_params(&mut self)
Refresh everything but the view
Sourcepub fn refresh_view(&mut self) -> Result<()>
pub fn refresh_view(&mut self) -> Result<()>
Refresh the current view. displayed files is reset. The first file is selected.
Sourcepub fn refresh_if_needed(&mut self) -> Result<()>
pub fn refresh_if_needed(&mut self) -> Result<()>
Refresh the view if files were modified in current directory.
If a refresh occurs, tries to select the same file as before.
If it can’t, the first file (.) is selected.
Does nothing in DisplayMode::Preview.
Sourcepub fn set_display_mode(&mut self, new_display_mode: Display)
pub fn set_display_mode(&mut self, new_display_mode: Display)
Change the display mode.
Sourcepub fn toggle_tree_mode(&mut self) -> Result<()>
pub fn toggle_tree_mode(&mut self) -> Result<()>
Enter or leave display tree mode.
Sourcepub fn make_preview(&mut self) -> Result<()>
pub fn make_preview(&mut self) -> Result<()>
Creates a new preview for the selected file. If the selected file is a directory, it will create a tree. Does nothing if directory is empty or in flagged or preview display mode.
Sourcepub fn refresh_and_reselect_file(&mut self) -> Result<()>
pub fn refresh_and_reselect_file(&mut self) -> Result<()>
Refresh the folder, reselect the last selected file, move the window to it.
Sourcepub fn select_by_path(&mut self, selected_path: Arc<Path>)
pub fn select_by_path(&mut self, selected_path: Arc<Path>)
Select the given file from its path. Action depends of the display mode. For directory or tree, it selects the file and scroll to it. when the file doesn’t exists,
- in directory mode, the first file is selected;
- in tree mode, the root is selected.
For preview or fuzzy, it does nothing
Sourcepub fn reset_display_mode_and_view(&mut self) -> Result<()>
pub fn reset_display_mode_and_view(&mut self) -> Result<()>
Reset the display mode and its view.
pub fn set_filter(&mut self, filter: FilterKind) -> Result<()>
Sourcepub fn set_height(&mut self, height: usize)
pub fn set_height(&mut self, height: usize)
Set the height of the window and itself.
Display or hide hidden files (filename starting with .).
Sourcepub fn sort(&mut self, c: char) -> Result<()>
pub fn sort(&mut self, c: char) -> Result<()>
Sort the file with given criteria Valid kind of sorts are : by kind : directory first, files next, in alphanumeric order by filename, by date of modification, by size, by extension. The first letter is used to identify the method. If the user types an uppercase char, the sort is reverse.
pub fn set_sortkind_per_mode(&mut self)
pub fn cd_to_file(&mut self, path: &Path) -> Result<()>
pub fn try_cd_to_file(&mut self, path_str: String) -> Result<bool>
Sourcepub fn cd(&mut self, path: &Path) -> Result<()>
pub fn cd(&mut self, path: &Path) -> Result<()>
Set the pathcontent to a new path. Reset the window. Add the last path to the history of visited paths. Does nothing in preview or flagged display mode.
pub fn back(&mut self) -> Result<()>
Sourcepub fn go_to_file<P>(&mut self, file: P)
pub fn go_to_file<P>(&mut self, file: P)
Select a file in current view, either directory or tree mode.
Sourcepub fn jump(&mut self, jump_target: PathBuf) -> Result<()>
pub fn jump(&mut self, jump_target: PathBuf) -> Result<()>
Jump to the jump target. Change the pathcontent and the tree if the jump target isn’t in the currently displayed files.
Sourcepub fn history_cd_to_last(&mut self) -> Result<()>
pub fn history_cd_to_last(&mut self) -> Result<()>
Move back to a previously visited path. It may fail if the user has no permission to visit the path
Sourcepub fn move_to_parent(&mut self) -> Result<()>
pub fn move_to_parent(&mut self) -> Result<()>
Move to the parent of current path
Sourcepub fn go_to_index(&mut self, index: usize)
pub fn go_to_index(&mut self, index: usize)
Select the file at index and move the window to this file.
Sourcepub fn go_to_selected_dir(&mut self) -> Result<()>
pub fn go_to_selected_dir(&mut self) -> Result<()>
Move to the currently selected directory. Fail silently if the current directory is empty or if the selected file isn’t a directory.
Sourcepub fn normal_down_one_row(&mut self)
pub fn normal_down_one_row(&mut self)
Move down one row if possible.
Sourcepub fn normal_up_one_row(&mut self)
pub fn normal_up_one_row(&mut self)
Move up one row if possible.
Sourcepub fn normal_go_top(&mut self)
pub fn normal_go_top(&mut self)
Move to the top of the current directory.
Sourcepub fn normal_go_bottom(&mut self)
pub fn normal_go_bottom(&mut self)
Move to the bottom of current view.
Sourcepub fn normal_page_up(&mut self)
pub fn normal_page_up(&mut self)
Move 10 files up
Sourcepub fn normal_page_down(&mut self)
pub fn normal_page_down(&mut self)
Move down 10 rows
Sourcepub fn tree_go_to_root(&mut self) -> Result<()>
pub fn tree_go_to_root(&mut self) -> Result<()>
Fold every child node in the tree. Recursively explore the tree and fold every node. Reset the display.
Sourcepub fn tree_select_parent(&mut self) -> Result<()>
pub fn tree_select_parent(&mut self) -> Result<()>
Select the parent of current node. If we were at the root node, move to the parent and make a new tree.
Sourcepub fn tree_page_down(&mut self)
pub fn tree_page_down(&mut self)
Move down 10 times in the tree
Sourcepub fn tree_page_up(&mut self)
pub fn tree_page_up(&mut self)
Move up 10 times in the tree
Sourcepub fn tree_select_next(&mut self)
pub fn tree_select_next(&mut self)
Select the next sibling.
Sourcepub fn tree_select_prev(&mut self)
pub fn tree_select_prev(&mut self)
Select the previous siblging
Sourcepub fn tree_go_to_bottom_leaf(&mut self)
pub fn tree_go_to_bottom_leaf(&mut self)
Go to the last leaf.
Sourcepub fn tree_next_sibling(&mut self)
pub fn tree_next_sibling(&mut self)
Navigate to the next sibling of current file in tree mode.
Sourcepub fn tree_prev_sibling(&mut self)
pub fn tree_prev_sibling(&mut self)
Navigate to the previous sibling of current file in tree mode.
pub fn tree_enter_dir(&mut self, path: Arc<Path>) -> Result<()>
Sourcepub fn preview_go_top(&mut self)
pub fn preview_go_top(&mut self)
Move the preview to the top
Sourcepub fn preview_go_bottom(&mut self)
pub fn preview_go_bottom(&mut self)
Move the preview to the bottom
Sourcepub fn preview_page_up(&mut self)
pub fn preview_page_up(&mut self)
Move 30 lines up or an image in Ueberzug.
Sourcepub fn preview_page_down(&mut self)
pub fn preview_page_down(&mut self)
Move down 30 rows except for Ueberzug where it moves 1 image down
Sourcepub fn normal_select_row(&mut self, row: u16)
pub fn normal_select_row(&mut self, row: u16)
Select a clicked row in display directory
Sourcepub fn tree_select_row(&mut self, row: u16) -> Result<()>
pub fn tree_select_row(&mut self, row: u16) -> Result<()>
Select a clicked row in display tree
pub fn completion_search_files(&mut self) -> Vec<String>
pub fn directory_search_next(&mut self)
pub fn dir_enum_skip_take(&self) -> Take<Skip<Enumerate<Iter<'_, FileInfo>>>>
pub fn cd_origin_path(&mut self) -> Result<()>
pub fn save_origin_path(&mut self)
pub fn toggle_visual(&mut self)
pub fn reset_visual(&mut self)
Auto Trait Implementations§
impl Freeze for Tab
impl RefUnwindSafe for Tab
impl Send for Tab
impl Sync for Tab
impl Unpin for Tab
impl UnwindSafe for Tab
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more