pub struct App {Show 22 fields
pub core: MathypadCore,
pub scroll_offset: usize,
pub mode: Mode,
pub result_animations: Vec<Option<ResultAnimation>>,
pub file_path: Option<PathBuf>,
pub has_unsaved_changes: bool,
pub show_unsaved_dialog: bool,
pub show_save_as_dialog: bool,
pub save_as_input: String,
pub save_as_and_quit: bool,
pub separator_position: u16,
pub is_dragging_separator: bool,
pub is_hovering_separator: bool,
pub copy_flash_animations: Vec<Option<ResultAnimation>>,
pub copy_flash_is_result: Vec<bool>,
pub last_click_time: Option<Instant>,
pub last_click_position: Option<(u16, u16)>,
pub show_welcome_dialog: bool,
pub welcome_scroll_offset: usize,
pub pending_normal_command: Option<char>,
pub command_line: String,
pub command_cursor: usize,
}Expand description
Main application state for the mathematical notepad
Fields§
§core: MathypadCoreCore calculation and text state (shared with web UI)
scroll_offset: usize§mode: Mode§result_animations: Vec<Option<ResultAnimation>>§file_path: Option<PathBuf>§has_unsaved_changes: bool§show_unsaved_dialog: bool§show_save_as_dialog: bool§save_as_input: String§save_as_and_quit: bool§separator_position: u16§is_dragging_separator: bool§is_hovering_separator: bool§copy_flash_animations: Vec<Option<ResultAnimation>>§copy_flash_is_result: Vec<bool>§last_click_time: Option<Instant>§last_click_position: Option<(u16, u16)>§show_welcome_dialog: bool§welcome_scroll_offset: usize§pending_normal_command: Option<char>§command_line: String§command_cursor: usizeImplementations§
Source§impl App
impl App
Sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Insert a character at the current cursor position
Sourcepub fn delete_char(&mut self)
pub fn delete_char(&mut self)
Delete the character before the cursor
Sourcepub fn delete_word(&mut self)
pub fn delete_word(&mut self)
Delete the word before the cursor (Ctrl+W behavior)
Sourcepub fn move_cursor_up(&mut self)
pub fn move_cursor_up(&mut self)
Move cursor up one line
Sourcepub fn move_cursor_down(&mut self)
pub fn move_cursor_down(&mut self)
Move cursor down one line
Sourcepub fn move_cursor_left(&mut self)
pub fn move_cursor_left(&mut self)
Move cursor left one character
Sourcepub fn move_cursor_right(&mut self)
pub fn move_cursor_right(&mut self)
Move cursor right one character
Sourcepub fn delete_line(&mut self)
pub fn delete_line(&mut self)
Delete the entire current line (vim ‘dd’ command)
Sourcepub fn delete_char_at_cursor(&mut self)
pub fn delete_char_at_cursor(&mut self)
Delete character at cursor position (vim ‘x’ command)
Sourcepub fn move_word_forward(&mut self)
pub fn move_word_forward(&mut self)
Move cursor forward by one word (vim ‘w’ command) A word is a sequence of alphanumeric characters or underscores
Sourcepub fn move_word_backward(&mut self)
pub fn move_word_backward(&mut self)
Move cursor backward by one word (vim ‘b’ command)
Sourcepub fn move_word_forward_big(&mut self)
pub fn move_word_forward_big(&mut self)
Move cursor forward by one WORD (vim ‘W’ command) A WORD is a sequence of non-whitespace characters
Sourcepub fn move_word_backward_big(&mut self)
pub fn move_word_backward_big(&mut self)
Move cursor backward by one WORD (vim ‘B’ command)
Sourcepub fn delete_word_forward(&mut self)
pub fn delete_word_forward(&mut self)
Delete from cursor to the end of the current word (vim ‘dw’ command)
Sourcepub fn delete_word_backward(&mut self)
pub fn delete_word_backward(&mut self)
Delete from cursor to the beginning of the previous word (vim ‘db’ command)
Sourcepub fn delete_word_forward_big(&mut self)
pub fn delete_word_forward_big(&mut self)
Delete from cursor to the end of the current WORD (vim ‘dW’ command)
Sourcepub fn delete_word_backward_big(&mut self)
pub fn delete_word_backward_big(&mut self)
Delete from cursor to the beginning of the previous WORD (vim ‘dB’ command)
Sourcepub fn update_result(&mut self, line_index: usize)
pub fn update_result(&mut self, line_index: usize)
Update the calculation result for a given line
Sourcepub fn recalculate_all(&mut self)
pub fn recalculate_all(&mut self)
Recalculate all lines in the notebook
Sourcepub fn update_animations(&mut self)
pub fn update_animations(&mut self)
Update all animations and remove completed ones
Sourcepub fn get_result_animation(
&self,
line_index: usize,
) -> Option<&ResultAnimation>
pub fn get_result_animation( &self, line_index: usize, ) -> Option<&ResultAnimation>
Get the animation for a specific line
Sourcepub fn save_as(&mut self, path: PathBuf) -> Result<(), Error>
pub fn save_as(&mut self, path: PathBuf) -> Result<(), Error>
Save the current content to a new file
Sourcepub fn set_file_path(&mut self, path: Option<PathBuf>)
pub fn set_file_path(&mut self, path: Option<PathBuf>)
Set the file path (used when loading a file)
Sourcepub fn show_save_as_dialog(&mut self, quit_after_save: bool)
pub fn show_save_as_dialog(&mut self, quit_after_save: bool)
Show the save as dialog
Sourcepub fn save_as_from_dialog(&mut self) -> Result<bool, Error>
pub fn save_as_from_dialog(&mut self) -> Result<bool, Error>
Try to save with the current save-as filename
Sourcepub fn update_separator_position(&mut self, mouse_x: u16, terminal_width: u16)
pub fn update_separator_position(&mut self, mouse_x: u16, terminal_width: u16)
Update separator position based on mouse column position
Sourcepub fn is_mouse_over_separator(&self, mouse_x: u16, terminal_width: u16) -> bool
pub fn is_mouse_over_separator(&self, mouse_x: u16, terminal_width: u16) -> bool
Check if mouse position is over the separator (within a few columns for easier dragging)
Sourcepub fn start_dragging_separator(&mut self)
pub fn start_dragging_separator(&mut self)
Start dragging the separator
Sourcepub fn stop_dragging_separator(&mut self)
pub fn stop_dragging_separator(&mut self)
Stop dragging the separator
Sourcepub fn set_separator_hover(&mut self, hovering: bool)
pub fn set_separator_hover(&mut self, hovering: bool)
Set hover state for the separator
Sourcepub fn copy_to_clipboard(
&mut self,
text: &str,
line_index: usize,
is_result: bool,
) -> Result<(), String>
pub fn copy_to_clipboard( &mut self, text: &str, line_index: usize, is_result: bool, ) -> Result<(), String>
Copy text to clipboard and start flash animation
Sourcepub fn is_double_click(&mut self, mouse_x: u16, mouse_y: u16) -> bool
pub fn is_double_click(&mut self, mouse_x: u16, mouse_y: u16) -> bool
Check if a click is a double-click
Sourcepub fn get_copy_flash_animation(
&self,
line_index: usize,
) -> Option<&ResultAnimation>
pub fn get_copy_flash_animation( &self, line_index: usize, ) -> Option<&ResultAnimation>
Get the copy flash animation for a specific line
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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