pub struct NoteEditorState<'a> {
pub content: String,
pub view: View,
pub cursor: Cursor,
pub ast_nodes: Vec<Node>,
pub virtual_document: VirtualDocument<'a>,
pub symbols: Symbols,
/* private fields */
}Fields§
§content: String§view: View§cursor: Cursor§ast_nodes: Vec<Node>§virtual_document: VirtualDocument<'a>§symbols: SymbolsImplementations§
Source§impl<'a> NoteEditorState<'a>
impl<'a> NoteEditorState<'a>
pub fn new( content: &str, filename: &str, filepath: &Path, symbols: &Symbols, ) -> Self
pub fn viewport(&self) -> &Viewport
pub fn is_editing(&self) -> bool
pub fn insert_mode(&self) -> bool
pub fn set_insert_mode(&mut self, mode: bool)
pub fn vim_mode(&self) -> bool
pub fn set_vim_mode(&mut self, mode: bool)
pub fn editor_enabled(&self) -> bool
pub fn set_editor_enabled(&mut self, enabled: bool)
pub fn text_buffer(&self) -> Option<&TextBuffer>
pub fn enter_insert(&mut self, block_idx: usize)
pub fn exit_insert(&mut self)
Sourcepub fn commit_text_buffer(&mut self) -> Option<()>
pub fn commit_text_buffer(&mut self) -> Option<()>
Write the current text_buffer back to self.content if it was modified, re-parse AST nodes. Returns Some if content changed.
pub fn set_filename(&mut self, name: &str)
pub fn set_filepath(&mut self, path: &Path)
pub fn insert_char(&mut self, c: char)
pub fn delete_char(&mut self) -> Option<()>
pub fn active(&self) -> bool
pub fn previous_block_idx(&self) -> usize
pub fn current_block_idx(&self) -> usize
pub fn set_view(&mut self, view: View)
pub fn resize_viewport(&mut self, size: Size)
pub fn set_active(&mut self, active: bool)
pub fn theme(&self) -> Theme
Sourcepub fn set_theme(&mut self, theme: &Theme)
pub fn set_theme(&mut self, theme: &Theme)
Swaps the colour theme and re-lays out so the new colours take effect.
pub fn modified(&self) -> bool
pub fn selection(&self) -> Option<Selection>
pub fn is_selecting(&self) -> bool
Sourcepub fn toggle_selection(&mut self, mode: SelectionMode)
pub fn toggle_selection(&mut self, mode: SelectionMode)
Enters visual selection in mode, or exits if that mode is already active.
pub fn clear_selection(&mut self)
pub fn has_pending_count(&self) -> bool
pub fn push_count_digit(&mut self, digit: u8)
Sourcepub fn take_count(&mut self) -> Option<usize>
pub fn take_count(&mut self) -> Option<usize>
Consumes the pending count. None means no explicit count was given.
pub fn reset_count(&mut self)
pub fn awaiting_find_target(&self) -> bool
pub fn arm_find(&mut self, direction: Direction, till: bool)
pub fn clear_pending_find(&mut self)
pub fn take_pending_find(&mut self) -> Option<FindKind>
Sourcepub fn remember_find(&mut self, target: char, kind: FindKind)
pub fn remember_find(&mut self, target: char, kind: FindKind)
Records a completed find so ; and , can replay it.
pub fn last_find(&self) -> Option<(char, FindKind)>
pub fn awaiting_text_object(&self) -> bool
pub fn arm_text_object(&mut self, kind: TextObjectKind)
pub fn take_text_object(&mut self) -> Option<TextObjectKind>
pub fn clear_pending_text_object(&mut self)
pub fn awaiting_replace(&self) -> bool
pub fn arm_replace(&mut self)
pub fn clear_pending_replace(&mut self)
pub fn pending_operator(&self) -> Option<Operator>
Sourcepub fn pending_hint(&self) -> String
pub fn pending_hint(&self) -> String
A short hint of the in-flight command (e.g. 3d) for the mode indicator.
pub fn set_operator(&mut self, operator: Operator)
pub fn take_operator(&mut self) -> Option<Operator>
pub fn clear_operator(&mut self)
pub fn register(&self) -> &Register
pub fn set_register(&mut self, text: String, linewise: bool)
Sourcepub fn mark_undo_point(&mut self)
pub fn mark_undo_point(&mut self)
Records the current content as an undo point, discarding the redo stack.
pub fn undo(&mut self) -> bool
pub fn redo(&mut self) -> bool
Sourcepub fn splice(&mut self, range: Range<usize>, replacement: &str)
pub fn splice(&mut self, range: Range<usize>, replacement: &str)
Replaces range with replacement, re-parses, and leaves the cursor at
the edit site. Records an undo point first.
Sourcepub fn paste(&mut self, after: bool)
pub fn paste(&mut self, after: bool)
Pastes the register at (or after) the cursor. Linewise registers land on
their own line below (p) or above (P).
Sourcepub fn selection_range(&self) -> Option<Range<usize>>
pub fn selection_range(&self) -> Option<Range<usize>>
Source byte range from anchor to cursor. Charwise includes the character under the cursor; linewise rounds out to whole lines.
pub fn selected_text(&self) -> Option<String>
Sourcepub fn flash_yank(&mut self, range: Range<usize>)
pub fn flash_yank(&mut self, range: Range<usize>)
Flashes range to acknowledge a yank. The highlight fades on its own
after [YANK_FLASH_DURATION].
Sourcepub fn yank_flash_range(&self) -> Option<Range<usize>>
pub fn yank_flash_range(&self) -> Option<Range<usize>>
The range to flash right now, or None once the flash has elapsed.
pub fn cursor_left(&mut self, amount: usize)
pub fn cursor_right(&mut self, amount: usize)
pub fn cursor_to_end(&mut self)
pub fn cursor_jump(&mut self, idx: usize)
Sourcepub fn jump_to_offset(&mut self, offset: usize)
pub fn jump_to_offset(&mut self, offset: usize)
Move the cursor to an arbitrary source byte offset, switching the active
block (and its text buffer) when the target lies in another block. Unlike
Self::relayout_on_block_change this preserves a precise mid-block
target, so it is the primitive every vim motion moves through.
pub fn update_layout(&mut self)
pub fn cursor_up(&mut self, amount: usize)
pub fn cursor_down(&mut self, amount: usize)
pub fn save_to_file(&mut self) -> Result<()>
Trait Implementations§
Source§impl<'a> Clone for NoteEditorState<'a>
impl<'a> Clone for NoteEditorState<'a>
Source§fn clone(&self) -> NoteEditorState<'a>
fn clone(&self) -> NoteEditorState<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for NoteEditorState<'a>
impl<'a> Debug for NoteEditorState<'a>
Source§impl<'a> Default for NoteEditorState<'a>
impl<'a> Default for NoteEditorState<'a>
Source§fn default() -> NoteEditorState<'a>
fn default() -> NoteEditorState<'a>
Auto Trait Implementations§
impl<'a> Freeze for NoteEditorState<'a>
impl<'a> RefUnwindSafe for NoteEditorState<'a>
impl<'a> Send for NoteEditorState<'a>
impl<'a> Sync for NoteEditorState<'a>
impl<'a> Unpin for NoteEditorState<'a>
impl<'a> UnsafeUnpin for NoteEditorState<'a>
impl<'a> UnwindSafe for NoteEditorState<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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