pub struct Tab {Show 15 fields
pub mode: Mode,
pub previous_mode: Mode,
pub window: ContentWindow,
pub input: Input,
pub path_content: PathContent,
pub height: usize,
pub show_hidden: bool,
pub completion: Completion,
pub must_quit: bool,
pub preview: Preview,
pub history: History,
pub shortcut: Shortcut,
pub searched: Option<String>,
pub directory: Directory,
pub filter: FilterKind,
}Expand description
Holds every thing about the current tab of the application. Most of the mutation is done externally.
Fields§
§mode: ModeThe mode the application is currenty in
previous_mode: ModeThe mode previously set
window: ContentWindowThe indexes of displayed file
input: InputThe typed input by the user
path_content: PathContentFiles in current path
height: usizeHeight of the terminal window
read from command line
completion: CompletionCompletion list and index in it.
must_quit: boolTrue if the user issued a quit event (Key::Char('q') by default).
It’s used to exit the main loop before reseting the cursor.
preview: PreviewLines of the previewed files. Empty if not in preview mode.
history: HistoryVisited directories
shortcut: ShortcutPredefined shortcuts
searched: Option<String>Last searched string
directory: DirectoryOptional tree view
filter: FilterKindThe filter use before displaying files
Implementations§
source§impl Tab
impl Tab
sourcepub fn new(args: Args, height: usize, users_cache: UsersCache) -> FmResult<Self>
pub fn new(args: Args, height: usize, users_cache: UsersCache) -> FmResult<Self>
Creates a new tab from args and height.
sourcepub fn fill_completion(&mut self) -> FmResult<()>
pub fn fill_completion(&mut self) -> FmResult<()>
Fill the input string with the currently selected completion.
sourcepub fn refresh_view(&mut self) -> FmResult<()>
pub fn refresh_view(&mut self) -> FmResult<()>
Refresh the current view. Input string is emptied, the files are read again, the window of displayed files is reset. The first file is selected.
sourcepub fn go_to_child(&mut self) -> FmResult<()>
pub fn go_to_child(&mut self) -> FmResult<()>
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 set_height(&mut self, height: usize)
pub fn set_height(&mut self, height: usize)
Set the height of the window and itself.
sourcepub fn must_quit(&self) -> bool
pub fn must_quit(&self) -> bool
Returns true iff the application has to quit.
This methods allows use to reset the cursors and other
terminal parameters gracefully.
sourcepub fn path_content_str(&self) -> Option<&str>
pub fn path_content_str(&self) -> Option<&str>
Returns a string of the current directory path.
sourcepub fn set_pathcontent(&mut self, path: &Path) -> FmResult<()>
pub fn set_pathcontent(&mut self, path: &Path) -> FmResult<()>
Set the pathcontent to a new path. Reset the window. Add the last path to the history of visited paths.
sourcepub fn set_window(&mut self)
pub fn set_window(&mut self)
Set the window. Doesn’t require the lenght to be known.
sourcepub fn set_filter(&mut self, filter: FilterKind)
pub fn set_filter(&mut self, filter: FilterKind)
Apply the filter.
sourcepub fn find_jump_index(&self, jump_target: &Path) -> Option<usize>
pub fn find_jump_index(&self, jump_target: &Path) -> Option<usize>
Returns the correct index jump target to a flagged files.
sourcepub fn refresh_shortcuts(&mut self, mount_points: &[&Path])
pub fn refresh_shortcuts(&mut self, mount_points: &[&Path])
Refresh the shortcuts. It drops non “hardcoded” shortcuts and extend the vector with the mount points.
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 refresh_users(&mut self, users_cache: UsersCache) -> FmResult<()>
pub fn refresh_users(&mut self, users_cache: UsersCache) -> FmResult<()>
Refresh the existing users.
sourcepub fn search_from(&mut self, searched_name: &str, current_index: usize)
pub fn search_from(&mut self, searched_name: &str, current_index: usize)
Search in current directory for an file whose name contains searched_name,
from a starting position next_index.
We search forward from that position and start again from top if nothing is found.
We move the selection to the first matching file.
sourcepub fn tree_select_root(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_select_root(&mut self, colors: &Colors) -> FmResult<()>
Select the root node of the tree.
sourcepub fn move_to_parent(&mut self) -> FmResult<()>
pub fn move_to_parent(&mut self) -> FmResult<()>
Move to the parent of current path
sourcepub fn tree_select_parent(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_select_parent(&mut self, colors: &Colors) -> FmResult<()>
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, colors: &Colors) -> FmResult<()>
pub fn tree_page_down(&mut self, colors: &Colors) -> FmResult<()>
Move down 10 times in the tree
sourcepub fn tree_page_up(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_page_up(&mut self, colors: &Colors) -> FmResult<()>
Move up 10 times in the tree
sourcepub fn tree_select_next(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_select_next(&mut self, colors: &Colors) -> FmResult<()>
Select the next sibling.
sourcepub fn tree_select_prev(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_select_prev(&mut self, colors: &Colors) -> FmResult<()>
Select the previous siblging
sourcepub fn tree_select_first_child(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_select_first_child(&mut self, colors: &Colors) -> FmResult<()>
Select the first child if any.
sourcepub fn tree_go_to_bottom_leaf(&mut self, colors: &Colors) -> FmResult<()>
pub fn tree_go_to_bottom_leaf(&mut self, colors: &Colors) -> FmResult<()>
Go to the last leaf.
sourcepub fn current_path(&mut self) -> &Path
pub fn current_path(&mut self) -> &Path
Returns the current path. It Tree mode, it’s the path of the selected node. Else, it’s the current path of pathcontent.
sourcepub fn directory_of_selected(&self) -> FmResult<&Path>
pub fn directory_of_selected(&self) -> FmResult<&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 make_tree(&mut self, colors: &Colors) -> FmResult<()>
pub fn make_tree(&mut self, colors: &Colors) -> FmResult<()>
Makes a new tree of the current path.
sourcepub fn reset_mode(&mut self)
pub fn reset_mode(&mut self)
Reset the last mode. The last mode is set to normal again.
sourcepub fn need_second_window(&self) -> bool
pub fn need_second_window(&self) -> bool
Returns true if the current mode requires 2 windows. Only Tree, Normal & Preview doesn’t require 2 windows.