Struct TextEdit

Source
pub struct TextEdit {
    pub selection: Selection,
    /* private fields */
}
Expand description

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

Fields§

§selection: Selection

Implementations§

Source§

impl TextEdit

Source

pub fn new_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<XMSG> AsMut<TextEdit> for BaseEditor<XMSG>

Source§

fn as_mut(&mut self) -> &mut TextEdit

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<XMSG> AsRef<TextEdit> for BaseEditor<XMSG>

Source§

fn as_ref(&self) -> &TextEdit

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for TextEdit

Source§

fn clone(&self) -> TextEdit

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.