ExplorerState

Struct ExplorerState 

Source
pub struct ExplorerState {
Show 17 fields pub tree: FileTree, pub cursor_index: usize, pub show_hidden: bool, pub show_sizes: bool, pub filter_text: String, pub width: u16, pub scroll_offset: usize, pub visible_height: u16, pub input_mode: ExplorerInputMode, pub input_buffer: String, pub message: Option<String>, pub clipboard: ExplorerClipboard, pub selection: ExplorerSelection, pub visible: bool, pub popup: FileDetailsPopup, pub enable_colors: bool, pub tree_style: TreeStyle,
}
Expand description

State of the file explorer

Fields§

§tree: FileTree

The file tree structure

§cursor_index: usize

Index of the currently selected item in the flattened view

§show_hidden: bool

Whether to show hidden files

§show_sizes: bool

Whether to show file sizes

§filter_text: String

Current filter text

§width: u16

Width of the explorer panel

§scroll_offset: usize

Scroll offset for the view

§visible_height: u16

Visible height of the explorer window (set during render)

§input_mode: ExplorerInputMode

Current input mode

§input_buffer: String

Current input buffer (for create/rename/filter)

§message: Option<String>

Message to display (e.g., error or confirmation prompt)

§clipboard: ExplorerClipboard

Clipboard for copy/cut/paste operations

§selection: ExplorerSelection

Multi-file selection state

§visible: bool

Whether the explorer is currently visible

§popup: FileDetailsPopup

File details popup state

§enable_colors: bool

Enable file type syntax coloring

§tree_style: TreeStyle

Tree drawing style for visual hierarchy

Implementations§

Source§

impl ExplorerState

Source

pub fn new(root_path: PathBuf) -> Result<Self>

Create a new explorer state from a root path

Source

pub fn is_input_mode(&self) -> bool

Check if in input mode

Source

pub fn toggle_visibility(&mut self)

Toggle explorer visibility

Source

pub fn show(&mut self)

Show the explorer

Source

pub fn hide(&mut self)

Hide the explorer

Source

pub fn start_create_file(&mut self)

Start creating a new file

Source

pub fn start_create_dir(&mut self)

Start creating a new directory

Source

pub fn start_rename(&mut self)

Start renaming current item

Source

pub fn start_delete(&mut self)

Start delete confirmation

Source

pub fn start_filter(&mut self)

Start filter mode

Source

pub fn cancel_input(&mut self)

Cancel current input mode

Source

pub fn input_char(&mut self, c: char)

Add a character to input buffer

Source

pub fn input_backspace(&mut self)

Remove last character from input buffer

Source

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

Confirm current input operation

Source

pub fn visible_nodes(&self) -> Vec<&FileNode>

Get all visible nodes (respecting hidden files and filter)

Source

pub fn current_node(&self) -> Option<&FileNode>

Get the currently selected node

Source

pub fn current_path(&self) -> Option<&Path>

Get the path of the currently selected node

Source

pub fn move_cursor(&mut self, delta: isize)

Move the cursor by a delta amount

Source

pub const fn move_to_first(&mut self)

Move cursor to the first item

Source

pub fn move_to_last(&mut self)

Move cursor to the last item

Source

pub fn move_page(&mut self, height: u16, down: bool)

Move cursor by a page

Source

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

Toggle expand/collapse on the current directory

Source

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

Expand the current directory

Source

pub fn collapse_current(&mut self)

Collapse the current directory

Source

pub fn go_to_parent(&mut self)

Go to parent directory (change root to parent and position cursor on old root)

This implements nvim-tree style navigation:

  1. Change explorer root to parent directory
  2. Position cursor on the directory we just came from
Source

pub fn change_root_to_current(&mut self)

Change root to currently selected directory

If the current selection is a directory, make it the new root. If it’s a file, use its parent directory as the new root.

Source

pub fn set_filter(&mut self, text: String)

Set the filter text

Source

pub fn clear_filter(&mut self)

Clear the filter

Source

pub fn toggle_hidden(&mut self)

Toggle showing hidden files

Source

pub const fn toggle_sizes(&mut self)

Toggle showing file sizes

Source

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

Refresh the tree from the filesystem

Source

pub fn set_root(&mut self, path: PathBuf) -> Result<()>

Set a new root path

Source

pub const fn set_visible_height(&mut self, height: u16)

Set visible height (called from render)

Source

pub const fn update_scroll(&mut self)

Update scroll offset to keep cursor visible

Source

pub fn show_file_details(&mut self)

Show file details popup for the current node

Source

pub fn close_popup(&mut self)

Close the file details popup

Source

pub const fn is_popup_visible(&self) -> bool

Check if popup is visible

Source

pub fn sync_popup(&mut self)

Sync popup with current cursor position (update content if visible)

Source

pub fn yank_current(&mut self)

Yank (copy) current item to clipboard

Source

pub fn cut_current(&mut self)

Cut current item to clipboard

Source

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

Paste from clipboard to current directory

Source

pub fn enter_visual_mode(&mut self)

Enter visual selection mode

Source

pub fn exit_visual_mode(&mut self)

Exit visual selection mode

Source

pub fn toggle_select_current(&mut self)

Toggle selection of current item

Source

pub fn select_all(&mut self)

Select all visible items

Source

pub fn update_visual_selection(&mut self)

Update visual selection when cursor moves

Source

pub fn is_selected(&self, path: &Path) -> bool

Check if a path is selected

Source

pub fn yank_selected(&mut self)

Yank selected items to clipboard (for multi-selection)

Source

pub fn cut_selected(&mut self)

Cut selected items (for multi-selection)

Trait Implementations§

Source§

impl Clone for ExplorerState

Source§

fn clone(&self) -> ExplorerState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExplorerState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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