Struct text_editing::TextLine
source · [−]pub struct TextLine { /* private fields */ }
Expand description
The text line represents editable text lines.
Implementations
sourceimpl TextLine
impl TextLine
sourcepub fn cursor_movement(
forward: bool,
skip: bool
) -> fn(_: &TextLine, _: &mut usize) -> bool
pub fn cursor_movement(
forward: bool,
skip: bool
) -> fn(_: &TextLine, _: &mut usize) -> bool
Returns the appropriate movement function based on parameters forward
and skip
.
sourcepub fn skip_forward(&self, text_cursor: &mut usize) -> bool
pub fn skip_forward(&self, text_cursor: &mut usize) -> bool
Moves the text cursor forward until the end of the current word.
sourceimpl TextLine
impl TextLine
sourcepub fn add_char(&mut self, text_cursor: &mut usize, c: char)
pub fn add_char(&mut self, text_cursor: &mut usize, c: char)
Adds a char and updates the text cursor.
sourcepub fn remove_forward(&mut self, text_cursor: usize) -> bool
pub fn remove_forward(&mut self, text_cursor: usize) -> bool
Removes the next char if it exists.
sourcepub fn remove_forward_skip(&mut self, text_cursor: usize) -> bool
pub fn remove_forward_skip(&mut self, text_cursor: usize) -> bool
Removes the previous word if it exists.
sourcepub fn remove_back(&mut self, text_cursor: &mut usize) -> bool
pub fn remove_back(&mut self, text_cursor: &mut usize) -> bool
Removes the previous char if it exists and updates the text cursor.
sourcepub fn remove_back_skip(&mut self, text_cursor: &mut usize) -> bool
pub fn remove_back_skip(&mut self, text_cursor: &mut usize) -> bool
Removes the previous word if it exists and updates the text cursor.
sourceimpl TextLine
impl TextLine
sourcepub fn from_string(text: String) -> Self
pub fn from_string(text: String) -> Self
Creates a text line from a String
.
sourcepub fn string_index(&self, index: usize) -> usize
pub fn string_index(&self, index: usize) -> usize
Converts the character index to the string index.
sourcepub fn remove_range(&mut self, range: Range<usize>)
pub fn remove_range(&mut self, range: Range<usize>)
Removes the specified range from the text line.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TextLine
impl Send for TextLine
impl Sync for TextLine
impl Unpin for TextLine
impl UnwindSafe for TextLine
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more