pub struct Editor { /* private fields */ }Implementations§
Source§impl Editor
impl Editor
pub fn new() -> Self
pub fn with_content(content: String) -> Self
pub fn content(&self) -> &str
pub fn cursor(&self) -> usize
pub fn scroll_offset(&self) -> usize
pub fn vertical_scroll(&self) -> usize
Sourcepub fn cursor_line_col(&self) -> (usize, usize)
pub fn cursor_line_col(&self) -> (usize, usize)
Returns (line, col) of the cursor where col is the display width within the line.
pub fn line_count(&self) -> usize
Sourcepub fn visual_cursor(&self) -> usize
pub fn visual_cursor(&self) -> usize
Visual cursor column within the current line.
pub fn undo(&mut self) -> bool
pub fn redo(&mut self) -> bool
pub fn insert_char(&mut self, c: char)
pub fn insert_newline(&mut self)
pub fn delete_back(&mut self)
pub fn delete_forward(&mut self)
pub fn move_left(&mut self)
pub fn move_right(&mut self)
pub fn move_up(&mut self)
pub fn move_down(&mut self)
Sourcepub fn update_scroll(&mut self, visible_width: usize)
pub fn update_scroll(&mut self, visible_width: usize)
Update horizontal scroll for the current line.
Sourcepub fn update_vertical_scroll(&mut self, visible_height: usize)
pub fn update_vertical_scroll(&mut self, visible_height: usize)
Update vertical scroll to keep cursor visible within visible_height lines.
Sourcepub fn set_cursor_by_col(&mut self, col: usize)
pub fn set_cursor_by_col(&mut self, col: usize)
Set cursor by display column (single-line editors / mouse click).
Sourcepub fn set_cursor_by_position(&mut self, line: usize, col: usize)
pub fn set_cursor_by_position(&mut self, line: usize, col: usize)
Set cursor by (line, col) position (multi-line editors / mouse click).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl Send for Editor
impl Sync for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
impl UnwindSafe for Editor
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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