pub struct Editor { /* private fields */ }
Expand description
Stateful editor executing changes to the underlying LineBuffer
In comparison to the state-less LineBuffer
the Editor
keeps track of
the undo/redo history and has facilities for cut/copy/yank/paste
Implementations§
source§impl Editor
impl Editor
sourcepub const fn line_buffer(&self) -> &LineBuffer
pub const fn line_buffer(&self) -> &LineBuffer
Get the current LineBuffer
sourcepub fn get_buffer(&self) -> &str
pub fn get_buffer(&self) -> &str
Get the text of the current LineBuffer
sourcepub fn edit_buffer<F>(&mut self, func: F, undo_behavior: UndoBehavior)where
F: FnOnce(&mut LineBuffer),
pub fn edit_buffer<F>(&mut self, func: F, undo_behavior: UndoBehavior)where
F: FnOnce(&mut LineBuffer),
Edit the LineBuffer
in an undo-safe manner.
sourcepub fn get_selection(&self) -> Option<(usize, usize)>
pub fn get_selection(&self) -> Option<(usize, usize)>
If a selection is active returns the selected range, otherwise None. The range is guaranteed to be ascending.
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 !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