Struct rat_input::input::TextInputState
source · pub struct TextInputState {
pub cursor: Option<Position>,
pub area: Rect,
pub mouse: MouseFlags,
pub value: InputCore,
pub non_exhaustive: NonExhaustive,
}Expand description
Input state data.
Fields§
§cursor: Option<Position>The position of the cursor in screen coordinates. Can be directly used for [Frame::set_cursor()]
area: RectArea inside a possible block.
mouse: MouseFlagsMouse selection in progress.
value: InputCoreEditing core
non_exhaustive: NonExhaustiveConstruct with ..Default::default()
Implementations§
source§impl TextInputState
impl TextInputState
sourcepub fn set_offset(&mut self, offset: usize)
pub fn set_offset(&mut self, offset: usize)
Offset shown. This is corrected if the cursor wouldn’t be visible.
sourcepub fn set_cursor(&mut self, cursor: usize, extend_selection: bool)
pub fn set_cursor(&mut self, cursor: usize, extend_selection: bool)
Set the cursor position, reset selection.
sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Selection.
sourcepub fn set_selection(&mut self, anchor: usize, cursor: usize)
pub fn set_selection(&mut self, anchor: usize, cursor: usize)
Selection.
sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Selection.
sourcepub fn selection_str(&self) -> &str
pub fn selection_str(&self) -> &str
Selection.
sourcepub fn prev_word_boundary(&self) -> usize
pub fn prev_word_boundary(&self) -> usize
Previous word boundary
sourcepub fn next_word_boundary(&self) -> usize
pub fn next_word_boundary(&self) -> usize
Next word boundary
sourcepub fn set_visual_cursor(&mut self, rpos: isize, extend_selection: bool)
pub fn set_visual_cursor(&mut self, rpos: isize, extend_selection: bool)
Set the cursor position from a visual position relative to the origin.
sourcepub fn screen_cursor(&self) -> Option<Position>
pub fn screen_cursor(&self) -> Option<Position>
The current text cursor as an absolute screen position.
sourcepub fn move_to_next(&mut self, extend_selection: bool)
pub fn move_to_next(&mut self, extend_selection: bool)
Move to the next char.
sourcepub fn move_to_prev(&mut self, extend_selection: bool)
pub fn move_to_prev(&mut self, extend_selection: bool)
Move to the previous char.
sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Insert a char a the current position.
sourcepub fn replace(&mut self, range: Range<usize>, new: &str)
pub fn replace(&mut self, range: Range<usize>, new: &str)
Replace the given range with a new string.
sourcepub fn delete_prev_char(&mut self)
pub fn delete_prev_char(&mut self)
Delete the char before the cursor.
sourcepub fn delete_next_char(&mut self)
pub fn delete_next_char(&mut self)
Delete the char after the cursor.
Trait Implementations§
source§impl Clone for TextInputState
impl Clone for TextInputState
source§fn clone(&self) -> TextInputState
fn clone(&self) -> TextInputState
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for TextInputState
impl Debug for TextInputState
source§impl Default for TextInputState
impl Default for TextInputState
source§impl HandleEvent<Event, FocusKeys, Outcome> for TextInputState
impl HandleEvent<Event, FocusKeys, Outcome> for TextInputState
Auto Trait Implementations§
impl Freeze for TextInputState
impl RefUnwindSafe for TextInputState
impl Send for TextInputState
impl Sync for TextInputState
impl Unpin for TextInputState
impl UnwindSafe for TextInputState
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> 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