Thanks to visit codestin.com
Credit goes to docs.rs

App

Struct App 

Source
pub struct App {
Show 61 fields pub document: Document, pub filename: String, pub tree: Vec<HeadingNode>, pub outline_state: ListState, pub outline_scroll_state: ScrollbarState, pub focus: Focus, pub outline_items: Vec<OutlineItem>, pub content_scroll: u16, pub content_scroll_state: ScrollbarState, pub content_height: u16, pub content_viewport_height: u16, pub show_help: bool, pub help_scroll: u16, pub show_search: bool, pub outline_search_active: bool, pub search_query: String, pub highlighter: SyntaxHighlighter, pub show_outline: bool, pub outline_width: u16, pub bookmark_position: Option<String>, pub current_theme: ThemeName, pub theme: Theme, pub show_theme_picker: bool, pub theme_picker_selected: usize, pub theme_picker_original: Option<ThemeName>, pub mode: AppMode, pub count_prefix: Option<usize>, pub current_file_path: PathBuf, pub file_path_changed: bool, pub suppress_file_watch: bool, pub links_in_view: Vec<Link>, pub filtered_link_indices: Vec<usize>, pub selected_link_idx: Option<usize>, pub link_search_query: String, pub link_search_active: bool, pub file_history: Vec<FileState>, pub file_future: Vec<FileState>, pub status_message: Option<String>, pub status_message_time: Option<Instant>, pub interactive_state: InteractiveState, pub cell_edit_value: String, pub cell_edit_original_value: String, pub cell_edit_row: usize, pub cell_edit_col: usize, pub pending_edits: Vec<PendingEdit>, pub has_unsaved_changes: bool, pub pending_editor_file: Option<PathBuf>, pub show_raw_source: bool, pub pending_file_create: Option<PathBuf>, pub pending_file_create_message: Option<String>, pub doc_search_query: String, pub doc_search_matches: Vec<SearchMatch>, pub doc_search_current_idx: Option<usize>, pub doc_search_active: bool, pub doc_search_from_interactive: bool, pub doc_search_selected_link_idx: Option<usize>, pub command_query: String, pub command_filtered: Vec<usize>, pub command_selected: usize, pub keybindings: Keybindings, pub pending_navigation: Option<PendingNavigation>, /* private fields */
}

Fields§

§document: Document§filename: String§tree: Vec<HeadingNode>§outline_state: ListState§outline_scroll_state: ScrollbarState§focus: Focus§outline_items: Vec<OutlineItem>§content_scroll: u16§content_scroll_state: ScrollbarState§content_height: u16§content_viewport_height: u16§show_help: bool§help_scroll: u16§show_search: bool§outline_search_active: bool§search_query: String§highlighter: SyntaxHighlighter§show_outline: bool§outline_width: u16§bookmark_position: Option<String>§current_theme: ThemeName§theme: Theme§show_theme_picker: bool§theme_picker_selected: usize§theme_picker_original: Option<ThemeName>§mode: AppMode§count_prefix: Option<usize>

Vim-style count prefix for motion commands (e.g., 5j moves down 5)

§current_file_path: PathBuf§file_path_changed: bool§suppress_file_watch: bool§links_in_view: Vec<Link>§filtered_link_indices: Vec<usize>§selected_link_idx: Option<usize>§link_search_query: String§link_search_active: bool§file_history: Vec<FileState>§file_future: Vec<FileState>§status_message: Option<String>§status_message_time: Option<Instant>§interactive_state: InteractiveState§cell_edit_value: String§cell_edit_original_value: String§cell_edit_row: usize§cell_edit_col: usize§pending_edits: Vec<PendingEdit>§has_unsaved_changes: bool§pending_editor_file: Option<PathBuf>§show_raw_source: bool§pending_file_create: Option<PathBuf>§pending_file_create_message: Option<String>§doc_search_query: String§doc_search_matches: Vec<SearchMatch>§doc_search_current_idx: Option<usize>§doc_search_active: bool§doc_search_from_interactive: bool§doc_search_selected_link_idx: Option<usize>§command_query: String§command_filtered: Vec<usize>§command_selected: usize§keybindings: Keybindings§pending_navigation: Option<PendingNavigation>

Implementations§

Source§

impl App

Source

pub fn new( document: Document, filename: String, file_path: PathBuf, config: Config, color_mode: ColorMode, ) -> Self

Source

pub fn set_viewport_height(&mut self, height: u16)

Update the content viewport height (called by UI when terminal size is known)

Source

pub fn current_keybinding_mode(&self) -> KeybindingMode

Get the current keybinding mode based on app state

Source

pub fn get_action_for_key( &mut self, code: KeyCode, modifiers: KeyModifiers, ) -> Option<Action>

Get the action for a key press in the current mode

Source

pub fn execute_action(&mut self, action: Action) -> ActionResult

Execute an action, returning the result type

Returns:

  • ActionResult::Continue - continue the main loop
  • ActionResult::Quit - exit the application
  • ActionResult::RunEditor(PathBuf, Option<u32>) - run editor on file at optional line
Source

pub fn toggle_raw_source(&mut self)

Toggle between raw source view and rendered markdown view

Source

pub fn set_status_message(&mut self, msg: &str)

Set a status message with automatic timeout tracking

Source

pub fn clear_expired_status_message(&mut self)

Clear status message if it has expired (default 1 second timeout)

Source

pub fn accumulate_count_digit(&mut self, digit: char) -> bool

Accumulate a digit into the vim-style count prefix Returns true if the digit was handled as a count prefix

Source

pub fn take_count(&mut self) -> usize

Get and consume the count prefix, returning at least 1

Source

pub fn clear_count(&mut self)

Clear the count prefix without consuming it

Source

pub fn has_count(&self) -> bool

Check if there’s an active count prefix

Source

pub fn update_content_metrics(&mut self)

Update content height based on current selection and reset scroll if selection changed

Source

pub fn next(&mut self)

Source

pub fn previous(&mut self)

Source

pub fn first(&mut self)

Source

pub fn last(&mut self)

Source

pub fn jump_to_parent(&mut self)

Source

pub fn toggle_help(&mut self)

Source

pub fn scroll_help_down(&mut self)

Source

pub fn scroll_help_up(&mut self)

Source

pub fn scroll_help_page_down(&mut self)

Scroll help popup down by half a page

Source

pub fn scroll_help_page_up(&mut self)

Scroll help popup up by half a page

Source

pub fn toggle_search_mode(&mut self)

Toggle between outline search and document search, preserving the query. After search is accepted (Enter pressed), Tab cycles through matches instead.

Source

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

Source

pub fn search_backspace(&mut self)

Source

pub fn filter_outline(&mut self)

Enter document search mode (activated by / when content is focused or in interactive mode) If in accepted outline search state, re-enter outline search input instead If already in accepted doc search state, re-enter doc search input

Source

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

Add a character to the document search query

Source

pub fn doc_search_backspace(&mut self)

Remove the last character from the document search query

Source

pub fn update_doc_search_matches(&mut self)

Update search matches based on current query (supports fuzzy and exact matching)

Accept search and exit search input mode (keep matches for n/N navigation)

Cancel search and return to previous mode (interactive or normal)

Clear search highlighting and return to previous mode (interactive or normal)

Source

pub fn next_doc_match(&mut self)

Navigate to next search match Handles both doc search matches and accepted outline search navigation

Source

pub fn prev_doc_match(&mut self)

Navigate to previous search match Handles both doc search matches and accepted outline search navigation

Source

pub fn doc_search_status(&self) -> String

Get document search status text for status bar

Source

pub fn scroll_page_down(&mut self)

Source

pub fn scroll_page_up(&mut self)

Source

pub fn scroll_page_down_interactive(&mut self)

Scroll page down in interactive mode (bypasses focus check)

Source

pub fn scroll_page_up_interactive(&mut self)

Scroll page up in interactive mode (bypasses focus check)

Source

pub fn scroll_to_interactive_element(&mut self, viewport_height: u16)

Auto-scroll to keep the selected interactive element in view viewport_height: height of the visible content area (in lines)

Source

pub fn toggle_expand(&mut self)

Source

pub fn expand(&mut self)

Source

pub fn collapse(&mut self)

Source

pub fn collapse_all(&mut self)

Collapse all headings that have children

Source

pub fn expand_all(&mut self)

Expand all headings

Source

pub fn collapse_level(&mut self, level: usize)

Collapse all headings at a specific level (1-6)

Source

pub fn expand_level(&mut self, level: usize)

Expand all headings at a specific level (1-6)

Source

pub fn toggle_focus(&mut self)

Source

pub fn toggle_focus_back(&mut self)

Toggle focus backwards (Shift+Tab) - cycles to previous item when search is locked in

Source

pub fn toggle_outline(&mut self)

Source

pub fn cycle_outline_width(&mut self, increase: bool)

Cycle outline width between 20%, 30%, and 40%.

Behavior depends on user’s config:

  • New users (default or standard width in config): Changes are persisted to config file for a seamless experience.
  • Power users (custom width like 25% in config): Changes are session-only to protect their carefully crafted config from accidental overwrites. They can explicitly save with S key.

This respects the principle that user config should always take precedence.

Source

pub fn show_save_width_confirmation(&mut self)

Show confirmation modal for saving outline width. Called when user presses S.

Source

pub fn confirm_save_outline_width(&mut self)

Confirm and save outline width to config file.

Source

pub fn cancel_save_width_confirmation(&mut self)

Cancel the save width confirmation modal.

Source

pub fn open_command_palette(&mut self)

Open command palette (triggered by :)

Source

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

Add a character to command palette search

Source

pub fn command_palette_backspace(&mut self)

Remove last character from command palette search

Source

pub fn command_palette_next(&mut self)

Move selection down in command palette

Source

pub fn command_palette_prev(&mut self)

Move selection up in command palette

Source

pub fn command_palette_autocomplete(&mut self)

Autocomplete command palette with selected command’s alias

Source

pub fn close_command_palette(&mut self)

Close command palette without executing

Source

pub fn execute_selected_command(&mut self) -> bool

Execute selected command and return whether to quit

Source

pub fn selected_command(&self) -> Option<&'static PaletteCommand>

Get selected command for display

Source

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

Source

pub fn set_bookmark(&mut self)

Source

pub fn jump_to_bookmark(&mut self)

Source

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

Source

pub fn selected_heading_source_line(&self) -> Option<u32>

Get the source line number (1-indexed) for the currently selected heading.

Returns None if no heading is selected or if the selection is the document overview.

Source

pub fn sync_previous_selection(&mut self)

Sync previous_selection to current selection (prevents spurious scroll resets)

Source

pub fn toggle_theme_picker(&mut self)

Source

pub fn theme_picker_next(&mut self)

Source

pub fn theme_picker_previous(&mut self)

Source

pub fn apply_selected_theme(&mut self)

Source

pub fn editor_config(&self) -> EditorConfig

Get the editor configuration for external file editing

Source

pub fn copy_content(&mut self)

Source

pub fn copy_anchor(&mut self)

Enter link follow mode - extract links from current section and highlight them

Exit link follow mode and return to normal mode

Start link search mode

Stop link search mode (but keep the filter)

Clear link search and show all links

Add a character to the link search query

Remove the last character from the link search query

Cycle to the next link (Tab in link follow mode)

Cycle to the previous link (Shift+Tab in link follow mode)

Jump to parent heading while staying in link follow mode

Get the currently selected link (from filtered list)

Follow the currently selected link

Source

pub fn go_back(&mut self) -> Result<(), String>

Navigate back in file history

Source

pub fn go_forward(&mut self) -> Result<(), String>

Navigate forward in file history

Source

pub fn reload_current_file(&mut self) -> Result<(), String>

Reload current file from disk (used after external editing)

Source

pub fn enter_interactive_mode(&mut self)

Enter interactive mode - build element index and enter mode

Source

pub fn exit_interactive_mode(&mut self)

Exit interactive mode and return to normal

Source

pub fn confirm_file_create(&mut self) -> Result<(), String>

Confirm file creation and open the new file

Source

pub fn cancel_file_create(&mut self)

Cancel file creation and return to previous mode

Source

pub fn get_selected_interactive_element(&self) -> Option<&InteractiveElement>

Get the currently selected interactive element

Source

pub fn activate_interactive_element(&mut self) -> Result<(), String>

Activate the currently selected interactive element

Source

pub fn reindex_interactive_elements(&mut self)

Re-index interactive elements after state changes

Source

pub fn copy_table_cell(&mut self) -> Result<(), String>

Copy table cell to clipboard

Source

pub fn copy_table_row(&mut self) -> Result<(), String>

Copy table row to clipboard (tab-separated)

Source

pub fn copy_table_markdown(&mut self) -> Result<(), String>

Copy entire table as markdown

Source

pub fn enter_cell_edit_mode(&mut self) -> Result<(), String>

Enter cell edit mode for the currently selected table cell

Source

pub fn save_edited_cell(&mut self) -> Result<(), String>

Buffer the edited cell value in memory (does not write to file) Use save_pending_edits_to_file() to write changes to disk

Source

pub fn save_pending_edits_to_file(&mut self) -> Result<(), String>

Write all pending edits to the file

Source

pub fn undo_last_edit(&mut self) -> Result<(), String>

Undo the last pending edit

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl Sync for App

§

impl Unpin for App

§

impl !UnwindSafe for App

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

impl<T> From<T> for T

§

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
§

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

§

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<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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