Tab

Struct Tab 

Source
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: Display

Kind of display: Preview, Normal, Tree

§directory: Directory

Files in current path

§tree: Tree

Tree representation of the same path

§preview: Preview

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

§menu_mode: Menu

The menu currently opened in this tab. Most of the time is spent in EditMode::Nothing

§window: ContentWindow

The indexes of displayed file

§height: usize

Height of the terminal window

§settings: TabSettings

Internal & display settings: show hidden files ? sort method filter kind

§search: Search

Last searched string

§history: History

Visited directories

§users: Users

Users & groups

§origin_path: Option<PathBuf>

Saved path before entering “CD” mode. Used if the cd is canceled

§visual: bool

Implementations§

Source§

impl Tab

Source

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)
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 current_path(&self) -> &Path

Current path of this tab in directory display mode.

Source

pub fn current_file(&self) -> Result<FileInfo>

Fileinfo of the selected element.

Source

pub fn current_file_string(&self) -> Result<String>

Path of the currently selected file.

Source

pub fn need_menu_window(&self) -> bool

Returns true if the current mode requires 2 windows. Only Tree, Normal & Preview doesn’t require 2 windows.

Source

pub fn directory_str(&self) -> String

Returns a string of the current directory path.

Source

pub fn refresh_params(&mut self)

Refresh everything but the view

Source

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

Refresh the current view. displayed files is reset. The first file is selected.

Source

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.

Source

pub fn set_display_mode(&mut self, new_display_mode: Display)

Change the display mode.

Source

pub fn make_tree(&mut self, sort_kind: Option<SortKind>)

Makes a new tree of the current path.

Source

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

Enter or leave display tree mode.

Source

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.

Source

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

Refresh the folder, reselect the last selected file, move the window to it.

Source

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

Source

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

Reset the display mode and its view.

Source

pub fn set_filter(&mut self, filter: FilterKind) -> Result<()>

Source

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

Set the height of the window and itself.

Source

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

Display or hide hidden files (filename starting with .).

Source

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

Set the line index to index and scroll there.

Source

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.

Source

pub fn set_sortkind_per_mode(&mut self)

Source

pub fn cd_to_file(&mut self, path: &Path) -> Result<()>

Source

pub fn try_cd_to_file(&mut self, path_str: String) -> Result<bool>

Source

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.

Source

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

Source

pub fn go_to_file<P>(&mut self, file: P)
where P: AsRef<Path>,

Select a file in current view, either directory or tree mode.

Source

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.

Source

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

Source

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

Move to the parent of current path

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 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.

Source

pub fn normal_down_one_row(&mut self)

Move down one row if possible.

Source

pub fn normal_up_one_row(&mut self)

Move up one row if possible.

Source

pub fn normal_go_top(&mut self)

Move to the top of the current directory.

Source

pub fn normal_go_bottom(&mut self)

Move to the bottom of current view.

Source

pub fn normal_page_up(&mut self)

Move 10 files up

Source

pub fn normal_page_down(&mut self)

Move down 10 rows

Source

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.

Source

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.

Source

pub fn tree_page_down(&mut self)

Move down 10 times in the tree

Source

pub fn tree_page_up(&mut self)

Move up 10 times in the tree

Source

pub fn tree_select_next(&mut self)

Select the next sibling.

Source

pub fn tree_select_prev(&mut self)

Select the previous siblging

Source

pub fn tree_go_to_bottom_leaf(&mut self)

Go to the last leaf.

Source

pub fn tree_next_sibling(&mut self)

Navigate to the next sibling of current file in tree mode.

Source

pub fn tree_prev_sibling(&mut self)

Navigate to the previous sibling of current file in tree mode.

Source

pub fn tree_enter_dir(&mut self, path: Arc<Path>) -> Result<()>

Source

pub fn preview_go_top(&mut self)

Move the preview to the top

Source

pub fn preview_go_bottom(&mut self)

Move the preview to the bottom

Source

pub fn preview_page_up(&mut self)

Move 30 lines up or an image in Ueberzug.

Source

pub fn preview_page_down(&mut self)

Move down 30 rows except for Ueberzug where it moves 1 image down

Source

pub fn normal_select_row(&mut self, row: u16)

Select a clicked row in display directory

Source

pub fn tree_select_row(&mut self, row: u16) -> Result<()>

Select a clicked row in display tree

Source

pub fn completion_search_files(&mut self) -> Vec<String>

Source

pub fn directory_search_next(&mut self)

Source

pub fn dir_enum_skip_take(&self) -> Take<Skip<Enumerate<Iter<'_, FileInfo>>>>

Source

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

Source

pub fn save_origin_path(&mut self)

Source

pub fn toggle_visual(&mut self)

Source

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSend for T
where T: Send,