Struct ultron_core::TextEdit

source ·
pub struct TextEdit {
    pub text_buffer: TextBuffer,
    pub selection: Selection,
    /* private fields */
}
Expand description

A struct with text_buffer, selection commands, and history recording for undo and redo editing

Fields§

§text_buffer: TextBuffer§selection: Selection

Implementations§

source§

impl TextEdit

source

pub fn from_str(content: &str) -> Self

source

pub fn text_buffer(&self) -> &TextBuffer

source

pub fn set_selection(&mut self, start: Point2<i32>, end: Point2<i32>)

source

pub fn set_selection_start(&mut self, start: Point2<i32>)

source

pub fn clear(&mut self)

source

pub fn set_selection_end(&mut self, end: Point2<i32>)

source

pub fn selection(&self) -> &Selection

source

pub fn command_insert_char(&mut self, ch: char)

source

pub fn get_char(&self, loc: Point2<usize>) -> Option<char>

source

pub fn command_smart_replace_insert_char(&mut self, ch: char)

source

pub fn command_replace_char(&mut self, ch: char)

source

pub fn command_delete_back(&mut self)

source

pub fn command_delete_forward(&mut self)

source

pub fn command_move_up(&mut self)

source

pub fn command_move_up_clamped(&mut self)

source

pub fn command_move_down(&mut self)

source

pub fn command_move_down_clamped(&mut self)

source

pub fn command_move_left(&mut self)

source

pub fn command_move_left_start(&mut self)

source

pub fn command_move_right(&mut self)

source

pub fn command_move_right_end(&mut self)

source

pub fn command_move_right_clamped(&mut self)

source

pub fn command_break_line(&mut self)

source

pub fn command_join_line(&mut self)

source

pub fn command_insert_text(&mut self, text: &str)

source

pub fn command_set_position(&mut self, cursor: Point2<usize>)

source

pub fn command_set_position_clamped(&mut self, cursor: Point2<usize>)

source

pub fn command_set_selection(&mut self, start: Point2<i32>, end: Point2<i32>)

source

pub fn command_select_all(&mut self)

source

pub fn command_select_all_block_mode(&mut self)

source

pub fn bump_history(&mut self)

Make a history separator for the undo/redo This is used for breaking undo action list

source

pub fn command_undo(&mut self)

source

pub fn command_redo(&mut self)

source

pub fn is_selected_in_linear_mode(&self, loc: Point2<i32>) -> bool

source

pub fn is_selected_in_block_mode(&self, loc: Point2<i32>) -> bool

source

pub fn clear_selection(&mut self)

clear the text selection

source

pub fn selected_text_in_linear_mode(&self) -> Option<String>

source

pub fn selected_text_in_block_mode(&self) -> Option<String>

source

pub fn cut_selected_text_in_linear_mode(&mut self) -> Option<String>

source

pub fn selection_normalized_casted( &self ) -> Option<(Point2<usize>, Point2<usize>)>

return the selection points which is normalized and casted into usize

source

pub fn selection_reorder_casted(&self) -> Option<(Point2<usize>, Point2<usize>)>

source

pub fn cut_selected_text_in_block_mode(&mut self) -> Option<String>

source

pub fn paste_text_in_block_mode(&mut self, text_block: String)

source

pub fn command_merge_text(&mut self, text_block: String)

paste the text block overlaying on the text content of the buffer excluding the whitespace

source

pub fn get_position(&self) -> Point2<usize>

source

pub fn max_position(&self) -> Point2<usize>

source

pub fn get_content(&self) -> String

source

pub fn total_lines(&self) -> usize

source

pub fn lines(&self) -> Vec<String>

source

pub fn numberline_wide(&self) -> usize

return the number of characters to represent the line number of the last line of the text buffer

Trait Implementations§

source§

impl Default for TextEdit

source§

fn default() -> TextEdit

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.