pub struct TextEditor(/* private fields */);texteditor only.Expand description
A text editor that supports basic editing operations such as insert, delete, and overwrite. It utilizes a cursor to navigate and manipulate the text.
Implementations§
Source§impl TextEditor
impl TextEditor
pub fn new<S: AsRef<str>>(s: S) -> Self
Sourcepub fn text(&self) -> StyledGraphemes
pub fn text(&self) -> StyledGraphemes
Returns the current text including the cursor.
Sourcepub fn text_without_cursor(&self) -> StyledGraphemes
pub fn text_without_cursor(&self) -> StyledGraphemes
Returns the text without the cursor.
Sourcepub fn masking(&self, mask: char) -> StyledGraphemes
pub fn masking(&self, mask: char) -> StyledGraphemes
Masks all characters except the cursor with the specified mask character.
Sourcepub fn replace(&mut self, new: &str)
pub fn replace(&mut self, new: &str)
Replaces the current text with new text and positions the cursor at the end.
pub fn insert_chars(&mut self, vch: &Vec<char>)
Sourcepub fn overwrite(&mut self, ch: char)
pub fn overwrite(&mut self, ch: char)
Overwrites the character at the current cursor position with the specified character.
pub fn overwrite_chars(&mut self, vch: &Vec<char>)
Sourcepub fn erase_to_previous_nearest(&mut self, word_break_chars: &HashSet<char>)
pub fn erase_to_previous_nearest(&mut self, word_break_chars: &HashSet<char>)
Erases the text from the current cursor position to the nearest previous character in word_break_chars.
Sourcepub fn move_to_previous_nearest(&mut self, word_break_chars: &HashSet<char>)
pub fn move_to_previous_nearest(&mut self, word_break_chars: &HashSet<char>)
Moves the cursor to the nearest previous character in word_break_chars.
Sourcepub fn erase_to_next_nearest(&mut self, word_break_chars: &HashSet<char>)
pub fn erase_to_next_nearest(&mut self, word_break_chars: &HashSet<char>)
Erases the text from the current cursor position to the nearest next character in word_break_chars.
Sourcepub fn move_to_next_nearest(&mut self, word_break_chars: &HashSet<char>)
pub fn move_to_next_nearest(&mut self, word_break_chars: &HashSet<char>)
Moves the cursor to the nearest next character in word_break_chars.
Sourcepub fn move_to_head(&mut self)
pub fn move_to_head(&mut self)
Moves the cursor to the beginning of the text.
Sourcepub fn move_to_tail(&mut self)
pub fn move_to_tail(&mut self)
Moves the cursor to the end of the text.
pub fn shift(&mut self, backward: usize, forward: usize) -> bool
Trait Implementations§
Source§impl Clone for TextEditor
impl Clone for TextEditor
Source§fn clone(&self) -> TextEditor
fn clone(&self) -> TextEditor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TextEditor
impl RefUnwindSafe for TextEditor
impl Send for TextEditor
impl Sync for TextEditor
impl Unpin for TextEditor
impl UnsafeUnpin for TextEditor
impl UnwindSafe for TextEditor
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> 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