Struct fm::tab::Tab

source ·
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: Mode

The mode the application is currenty in

§previous_mode: Mode

The mode previously set

§window: ContentWindow

The indexes of displayed file

§input: Input

The typed input by the user

§path_content: PathContent

Files in current path

§height: usize

Height of the terminal window

§show_hidden: bool

read from command line

§completion: Completion

Completion list and index in it.

§must_quit: bool

True 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: Preview

Lines of the previewed files. Empty if not in preview mode.

§history: History

Visited directories

§shortcut: Shortcut

Predefined shortcuts

§searched: Option<String>

Last searched string

§directory: Directory

Optional tree view

§filter: FilterKind

The filter use before displaying files

Implementations§

source§

impl Tab

source

pub fn new(args: Args, height: usize, users_cache: UsersCache) -> Result<Self>

Creates a new tab from args and height.

source

pub fn fill_completion(&mut self) -> Result<()>

Fill the input string with the currently selected completion.

source

pub fn refresh_view(&mut self) -> Result<()>

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.

source

pub fn go_to_child(&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.

source

pub fn set_height(&mut self, height: usize)

Set the height of the window and itself.

source

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.

source

pub fn path_content_str(&self) -> Option<&str>

Returns a string of the current directory path.

source

pub fn set_pathcontent(&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.

source

pub fn set_window(&mut self)

Set the window. Doesn’t require the lenght to be known.

source

pub fn set_filter(&mut self, filter: FilterKind)

Apply the filter.

source

pub fn scroll_to(&mut self, index: usize)

Set the line index to index and scroll there.

source

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.

source

pub fn go_to_index(&mut self, index: usize)

Select the file at index and move the window to this file.

source

pub fn refresh_users(&mut self, users_cache: UsersCache) -> Result<()>

Refresh the existing users.

source

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.

source

pub fn tree_select_root(&mut self, colors: &Colors) -> Result<()>

Select the root node of the tree.

source

pub fn move_to_parent(&mut self) -> Result<()>

Move to the parent of current path

source

pub fn tree_select_parent(&mut self, colors: &Colors) -> Result<()>

Select the parent of current node. If we were at the root node, move to the parent and make a new tree.

source

pub fn tree_page_down(&mut self, colors: &Colors) -> Result<()>

Move down 10 times in the tree

source

pub fn tree_page_up(&mut self, colors: &Colors) -> Result<()>

Move up 10 times in the tree

source

pub fn tree_select_next(&mut self, colors: &Colors) -> Result<()>

Select the next sibling.

source

pub fn tree_select_prev(&mut self, colors: &Colors) -> Result<()>

Select the previous siblging

source

pub fn tree_select_first_child(&mut self, colors: &Colors) -> Result<()>

Select the first child if any.

source

pub fn tree_go_to_bottom_leaf(&mut self, colors: &Colors) -> Result<()>

Go to the last leaf.

source

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.

source

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.

source

pub fn selected(&self) -> Option<&FileInfo>

Optional Fileinfo of the selected element.

source

pub fn make_tree(&mut self, colors: &Colors) -> Result<()>

Makes a new tree of the current path.

source

pub fn set_mode(&mut self, new_mode: Mode)

Set a new mode and save the last one

source

pub fn reset_mode(&mut self)

Reset the last mode. The last mode is set to normal again.

source

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.

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for Twhere T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> UnsafeAny for Twhere T: Any,