Skip to main content

App

Struct App 

Source
pub struct App { /* private fields */ }
Expand description

Main application state

Implementations§

Source§

impl App

Source

pub fn new() -> Self

Create a new app with an empty buffer

Source

pub fn from_file(path: impl AsRef<Path>) -> Result<Self>

Create app from a file

Source

pub fn from_string(content: &str) -> Result<Self>

Create app from a string content (for pipe mode)

Source

pub fn buffer(&self) -> &DocumentBuffer

Get the document buffer

Source

pub fn buffer_mut(&mut self) -> &mut DocumentBuffer

Get mutable document buffer

Source

pub fn set_pipe_mode(&mut self, pipe_mode: bool)

Set pipe mode (stdin/stdout piped)

Source

pub fn should_quit(&self) -> bool

Check if the app should quit

Source

pub fn scroll_offset(&self) -> usize

Get scroll offset

Source

pub fn image_manager(&self) -> &ImageManager

Get image manager

Source

pub fn image_manager_mut(&mut self) -> &mut ImageManager

Get mutable image manager

Source

pub fn diagnostics_manager(&self) -> &DiagnosticsManager

Get diagnostics manager

Source

pub fn code_renderer(&self) -> &CodeRenderer

Get code renderer

Source

pub fn code_renderer_mut(&mut self) -> &mut CodeRenderer

Get mutable code renderer

Source

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

Get status message

Source

pub fn set_status_message(&mut self, message: String)

Set status message

Source

pub fn clear_status_message(&mut self)

Clear status message

Source

pub fn filtered_completion_items(&self) -> &[CompletionItem]

Get completion items (filtered by current input)

Source

pub fn completion_selected(&self) -> usize

Get selected completion index

Source

pub fn show_completion(&self) -> bool

Check if completion popup is visible

Source

pub fn file_tree(&self) -> Option<&FileTree>

Get file tree

Source

pub fn file_tree_mut(&mut self) -> Option<&mut FileTree>

Get mutable file tree

Source

pub fn is_file_browser_visible(&self) -> bool

Check if file browser is visible

Source

pub fn toggle_file_browser(&mut self)

Toggle file browser visibility

Source

pub fn show_line_numbers(&self) -> bool

Check if line numbers are visible

Source

pub fn toggle_line_numbers(&mut self)

Toggle line numbers visibility

Source

pub fn show_current_line_highlight(&self) -> bool

Check if current line highlight is visible

Source

pub fn toggle_current_line_highlight(&mut self)

Toggle current line highlight visibility

Source

pub fn line_number_gutter_width(&self) -> u16

Calculate the width of line number gutter (including separator)

Source

pub fn open_file(&mut self, path: impl AsRef<Path>) -> Result<()>

Open file from path

Source

pub fn poll_lsp_events(&mut self)

Poll LSP events and update diagnostics

Source

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

Request go to definition at current cursor position

Source

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

Navigate back in history

Source

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

Navigate forward in history

Source

pub fn request_completion( &mut self, trigger_character: Option<String>, ) -> Result<()>

Request code completion at current cursor position

Source

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

Apply the selected completion item

Source

pub fn completion_up(&mut self)

Move completion selection up

Source

pub fn completion_down(&mut self)

Move completion selection down

Source

pub fn cancel_completion(&mut self)

Cancel completion popup

Source

pub fn show_quit_dialog(&self) -> bool

Check if quit dialog is visible

Source

pub fn confirm_quit(&mut self)

Confirm quit (called when user confirms in dialog)

Source

pub fn cancel_quit_dialog(&mut self)

Cancel quit dialog

Source

pub fn show_search_dialog(&self) -> bool

Check if search dialog is visible

Source

pub fn search_query(&self) -> &str

Get search query

Source

pub fn replace_query(&self) -> &str

Get replace query

Source

pub fn search_mode(&self) -> SearchMode

Get search mode

Source

pub fn search_match_count(&self) -> usize

Get search results count

Source

pub fn search_current_index(&self) -> Option<usize>

Get current search index

Source

pub fn search_active_field(&self) -> SearchField

Get active search field

Source

pub fn show_save_as_dialog(&self) -> bool

Check if save-as dialog is visible

Source

pub fn save_as_filename(&self) -> &str

Get save-as filename

Source

pub fn show_goto_line_dialog(&self) -> bool

Check if goto line dialog is visible

Source

pub fn goto_line_input(&self) -> &str

Get goto line input

Source

pub fn open_goto_line_dialog(&mut self)

Open goto line dialog

Source

pub fn close_goto_line_dialog(&mut self)

Close goto line dialog

Source

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

Confirm goto line with the entered line number

Source

pub fn show_mq_query_dialog(&self) -> bool

Check if mq query dialog is visible

Source

pub fn mq_query_input(&self) -> &str

Get mq query input

Source

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

Get mq query result

Source

pub fn open_mq_query_dialog(&mut self)

Open mq query dialog

Source

pub fn close_mq_query_dialog(&mut self)

Close mq query dialog

Source

pub fn execute_mq_query(&mut self)

Execute mq query against the current buffer content

Source

pub fn open_save_as_dialog(&mut self)

Open save-as dialog

Source

pub fn close_save_as_dialog(&mut self)

Close save-as dialog

Source

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

Confirm save-as with the entered filename

Open search dialog

Source

pub fn open_replace(&mut self)

Open replace dialog

Close search dialog

Source

pub fn search_next(&mut self)

Find next match

Source

pub fn search_prev(&mut self)

Find previous match

Source

pub fn replace_current(&mut self)

Replace current match

Source

pub fn replace_all(&mut self)

Replace all matches

Source

pub fn toggle_search_field(&mut self)

Toggle between search and replace fields

Source

pub fn handle_key(&mut self, key: KeyEvent) -> Result<()>

Handle keyboard input

Source

pub fn handle_paste(&mut self, text: String) -> Result<()>

Handle paste event (used for IME input and clipboard paste)

Trait Implementations§

Source§

impl Default for App

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl !UnwindSafe for App

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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> 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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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.