Trait masonry::text2::EditableTextCursor
source · pub trait EditableTextCursor {
// Required methods
fn set(&mut self, position: usize);
fn pos(&self) -> usize;
fn is_boundary(&self) -> bool;
fn prev(&mut self) -> Option<usize>;
fn next(&mut self) -> Option<usize>;
fn peek_next_codepoint(&self) -> Option<char>;
fn prev_codepoint(&mut self) -> Option<char>;
fn next_codepoint(&mut self) -> Option<char>;
fn at_or_next(&mut self) -> Option<usize>;
fn at_or_prev(&mut self) -> Option<usize>;
}
Expand description
A cursor with convenience functions for moving through EditableText
.
Required Methods§
sourcefn is_boundary(&self) -> bool
fn is_boundary(&self) -> bool
Check if cursor position is at a codepoint boundary.
sourcefn prev(&mut self) -> Option<usize>
fn prev(&mut self) -> Option<usize>
Move cursor to previous codepoint boundary, if it exists. Returns previous codepoint as usize offset.
sourcefn next(&mut self) -> Option<usize>
fn next(&mut self) -> Option<usize>
Move cursor to next codepoint boundary, if it exists. Returns current codepoint as usize offset.
sourcefn peek_next_codepoint(&self) -> Option<char>
fn peek_next_codepoint(&self) -> Option<char>
Get the next codepoint after the cursor position, without advancing the cursor.
sourcefn prev_codepoint(&mut self) -> Option<char>
fn prev_codepoint(&mut self) -> Option<char>
Return codepoint preceding cursor offset and move cursor backward.
sourcefn next_codepoint(&mut self) -> Option<char>
fn next_codepoint(&mut self) -> Option<char>
Return codepoint at cursor offset and move cursor forward.
sourcefn at_or_next(&mut self) -> Option<usize>
fn at_or_next(&mut self) -> Option<usize>
Return current offset if it’s a boundary, else next.
sourcefn at_or_prev(&mut self) -> Option<usize>
fn at_or_prev(&mut self) -> Option<usize>
Return current offset if it’s a boundary, else previous.