Struct rat_widget::textarea::RTextAreaState
source · pub struct RTextAreaState {
pub widget: TextAreaState,
pub non_exhaustive: NonExhaustive,
}Fields§
§widget: TextAreaState§non_exhaustive: NonExhaustiveImplementations§
source§impl RTextAreaState
impl RTextAreaState
pub fn new() -> Self
sourcepub fn set_offset(&mut self, offset: (usize, usize)) -> bool
pub fn set_offset(&mut self, offset: (usize, usize)) -> bool
Offset shown. This is corrected if the cursor wouldn’t be visible.
sourcepub fn set_cursor(
&mut self,
cursor: (usize, usize),
extend_selection: bool,
) -> bool
pub fn set_cursor( &mut self, cursor: (usize, usize), extend_selection: bool, ) -> bool
Set the cursor position, reset selection.
sourcepub fn value_range(&self, range: TextRange) -> Option<RopeSlice<'_>>
pub fn value_range(&self, range: TextRange) -> Option<RopeSlice<'_>>
Text value
sourcepub fn value_as_bytes(&self) -> Bytes<'_>
pub fn value_as_bytes(&self) -> Bytes<'_>
Text as Bytes iterator.
sourcepub fn value_as_chars(&self) -> Chars<'_>
pub fn value_as_chars(&self) -> Chars<'_>
Text as Btes iterator.
sourcepub fn set_value_rope(&mut self, s: Rope)
pub fn set_value_rope(&mut self, s: Rope)
Set the text value as a Rope. Resets all internal state.
sourcepub fn line_width(&self, n: usize) -> Option<usize>
pub fn line_width(&self, n: usize) -> Option<usize>
Line width as grapheme count.
sourcepub fn line(&self, n: usize) -> Option<RopeGraphemes<'_>>
pub fn line(&self, n: usize) -> Option<RopeGraphemes<'_>>
Grapheme iterator for a given line. This contains the \n at the end.
sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Selection.
sourcepub fn set_selection(&mut self, range: TextRange) -> bool
pub fn set_selection(&mut self, range: TextRange) -> bool
Selection.
sourcepub fn select_all(&mut self) -> bool
pub fn select_all(&mut self) -> bool
Selection.
sourcepub fn selected_value(&self) -> Option<RopeSlice<'_>>
pub fn selected_value(&self) -> Option<RopeSlice<'_>>
Selection.
sourcepub fn clear_styles(&mut self)
pub fn clear_styles(&mut self)
Clear all set styles.
sourcepub fn add_style(&mut self, range: TextRange, style: usize)
pub fn add_style(&mut self, range: TextRange, style: usize)
Add a style for a TextRange. The style-nr refers to one of the styles set with the widget.
sourcepub fn styles_at(&self, pos: (usize, usize), result: &mut Vec<usize>)
pub fn styles_at(&self, pos: (usize, usize), result: &mut Vec<usize>)
All styles active at the given position.
sourcepub fn byte_pos(&self, byte: usize) -> Option<(usize, usize)>
pub fn byte_pos(&self, byte: usize) -> Option<(usize, usize)>
Convert a byte position to a text area position. Uses grapheme based column indexes.
sourcepub fn byte_at(&self, pos: (usize, usize)) -> Option<(usize, usize)>
pub fn byte_at(&self, pos: (usize, usize)) -> Option<(usize, usize)>
Convert a text area position to a byte range. Uses grapheme based column indexes. Returns (byte-start, byte-end) of the grapheme at the given position.
sourcepub fn char_pos(&self, byte: usize) -> Option<(usize, usize)>
pub fn char_pos(&self, byte: usize) -> Option<(usize, usize)>
Convert a char position to a text area position. Uses grapheme based column indexes.
sourcepub fn char_at(&self, pos: (usize, usize)) -> Option<usize>
pub fn char_at(&self, pos: (usize, usize)) -> Option<usize>
Convert a text area position to a char position. Uses grapheme based column indexes.
sourcepub fn insert_char(&mut self, c: char) -> bool
pub fn insert_char(&mut self, c: char) -> bool
Insert a char at the current position.
sourcepub fn insert_newline(&mut self) -> bool
pub fn insert_newline(&mut self) -> bool
Insert a line break at the cursor position.
sourcepub fn delete_range(&mut self, range: TextRange) -> bool
pub fn delete_range(&mut self, range: TextRange) -> bool
Deletes the given range.
sourcepub fn delete_next_char(&mut self) -> bool
pub fn delete_next_char(&mut self) -> bool
Delete the char after the cursor.
sourcepub fn delete_prev_char(&mut self) -> bool
pub fn delete_prev_char(&mut self) -> bool
Delete the char before the cursor.
sourcepub fn delete_next_word(&mut self) -> bool
pub fn delete_next_word(&mut self) -> bool
Deletes the next word.
sourcepub fn delete_prev_word(&mut self) -> bool
pub fn delete_prev_word(&mut self) -> bool
Deletes the given range.
sourcepub fn move_left(&mut self, n: usize, extend_selection: bool) -> bool
pub fn move_left(&mut self, n: usize, extend_selection: bool) -> bool
Move the cursor left. Scrolls the cursor to visible. Returns true if there was any real change.
sourcepub fn move_right(&mut self, n: usize, extend_selection: bool) -> bool
pub fn move_right(&mut self, n: usize, extend_selection: bool) -> bool
Move the cursor right. Scrolls the cursor to visible. Returns true if there was any real change.
sourcepub fn move_up(&mut self, n: usize, extend_selection: bool) -> bool
pub fn move_up(&mut self, n: usize, extend_selection: bool) -> bool
Move the cursor up. Scrolls the cursor to visible. Returns true if there was any real change.
sourcepub fn move_down(&mut self, n: usize, extend_selection: bool) -> bool
pub fn move_down(&mut self, n: usize, extend_selection: bool) -> bool
Move the cursor down. Scrolls the cursor to visible. Returns true if there was any real change.
sourcepub fn move_to_line_start(&mut self, extend_selection: bool) -> bool
pub fn move_to_line_start(&mut self, extend_selection: bool) -> bool
Move the cursor to the start of the line. Scrolls the cursor to visible. Returns true if there was any real change.
sourcepub fn move_to_line_end(&mut self, extend_selection: bool) -> bool
pub fn move_to_line_end(&mut self, extend_selection: bool) -> bool
Move the cursor to the end of the line. Scrolls to visible, if necessary. Returns true if there was any real change.
sourcepub fn move_to_start(&mut self, extend_selection: bool) -> bool
pub fn move_to_start(&mut self, extend_selection: bool) -> bool
Move the cursor to the document start.
sourcepub fn move_to_end(&mut self, extend_selection: bool) -> bool
pub fn move_to_end(&mut self, extend_selection: bool) -> bool
Move the cursor to the document end.
sourcepub fn move_to_screen_start(&mut self, extend_selection: bool) -> bool
pub fn move_to_screen_start(&mut self, extend_selection: bool) -> bool
Move the cursor to the start of the visible area.
sourcepub fn move_to_screen_end(&mut self, extend_selection: bool) -> bool
pub fn move_to_screen_end(&mut self, extend_selection: bool) -> bool
Move the cursor to the end of the visible area.
pub fn move_to_next_word(&mut self, extend_selection: bool) -> bool
pub fn move_to_prev_word(&mut self, extend_selection: bool) -> bool
sourcepub fn from_screen_col(&self, row: usize, x: usize) -> Option<usize>
pub fn from_screen_col(&self, row: usize, x: usize) -> Option<usize>
Converts from a widget relative screen coordinate to a grapheme index. Row is a row-index into the value, not a screen-row. x is the relative screen position.
sourcepub fn to_screen_col(&self, pos: (usize, usize)) -> Option<u16>
pub fn to_screen_col(&self, pos: (usize, usize)) -> Option<u16>
Converts a grapheme based position to a screen position relative to the widget area.
sourcepub fn screen_cursor(&self) -> Option<(u16, u16)>
pub fn screen_cursor(&self) -> Option<(u16, u16)>
The current text cursor as an absolute screen position.
Trait Implementations§
source§impl Clone for RTextAreaState
impl Clone for RTextAreaState
source§fn clone(&self) -> RTextAreaState
fn clone(&self) -> RTextAreaState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RTextAreaState
impl Debug for RTextAreaState
source§impl Default for RTextAreaState
impl Default for RTextAreaState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextAreaState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextAreaState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextAreaState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextAreaState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextAreaState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextAreaState
source§impl HasFocusFlag for RTextAreaState
impl HasFocusFlag for RTextAreaState
source§impl ScrollingState for RTextAreaState
impl ScrollingState for RTextAreaState
source§fn vertical_max_offset(&self) -> usize
fn vertical_max_offset(&self) -> usize
source§fn vertical_offset(&self) -> usize
fn vertical_offset(&self) -> usize
source§fn vertical_page(&self) -> usize
fn vertical_page(&self) -> usize
source§fn horizontal_max_offset(&self) -> usize
fn horizontal_max_offset(&self) -> usize
source§fn horizontal_offset(&self) -> usize
fn horizontal_offset(&self) -> usize
source§fn horizontal_page(&self) -> usize
fn horizontal_page(&self) -> usize
source§fn set_vertical_offset(&mut self, offset: usize) -> bool
fn set_vertical_offset(&mut self, offset: usize) -> bool
source§fn set_horizontal_offset(&mut self, offset: usize) -> bool
fn set_horizontal_offset(&mut self, offset: usize) -> bool
source§fn vertical_scroll(&self) -> usize
fn vertical_scroll(&self) -> usize
source§fn horizontal_scroll(&self) -> usize
fn horizontal_scroll(&self) -> usize
source§fn scroll_up(&mut self, n: usize) -> bool
fn scroll_up(&mut self, n: usize) -> bool
source§fn scroll_down(&mut self, n: usize) -> bool
fn scroll_down(&mut self, n: usize) -> bool
source§fn scroll_left(&mut self, n: usize) -> bool
fn scroll_left(&mut self, n: usize) -> bool
source§fn scroll_right(&mut self, n: usize) -> bool
fn scroll_right(&mut self, n: usize) -> bool
source§impl<'a> ScrollingWidget<RTextAreaState> for RTextArea<'a>
impl<'a> ScrollingWidget<RTextAreaState> for RTextArea<'a>
source§fn need_scroll(&self, area: Rect, state: &mut RTextAreaState) -> (bool, bool)
fn need_scroll(&self, area: Rect, state: &mut RTextAreaState) -> (bool, bool)
Auto Trait Implementations§
impl !Freeze for RTextAreaState
impl !RefUnwindSafe for RTextAreaState
impl Send for RTextAreaState
impl !Sync for RTextAreaState
impl Unpin for RTextAreaState
impl UnwindSafe for RTextAreaState
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> 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