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
impl TextEdit
pub fn from_str(content: &str) -> Self
pub fn text_buffer(&self) -> &TextBuffer
pub fn set_selection(&mut self, start: Point2<i32>, end: Point2<i32>)
pub fn set_selection_start(&mut self, start: Point2<i32>)
pub fn clear(&mut self)
pub fn set_selection_end(&mut self, end: Point2<i32>)
pub fn selection(&self) -> &Selection
pub fn command_insert_char(&mut self, ch: char)
pub fn get_char(&self, loc: Point2<usize>) -> Option<char>
pub fn command_smart_replace_insert_char(&mut self, ch: char)
pub fn command_replace_char(&mut self, ch: char)
pub fn command_delete_back(&mut self)
pub fn command_delete_forward(&mut self)
pub fn command_move_up(&mut self)
pub fn command_move_up_clamped(&mut self)
pub fn command_move_down(&mut self)
pub fn command_move_down_clamped(&mut self)
pub fn command_move_left(&mut self)
pub fn command_move_left_start(&mut self)
pub fn command_move_right(&mut self)
pub fn command_move_right_end(&mut self)
pub fn command_move_right_clamped(&mut self)
pub fn command_break_line(&mut self)
pub fn command_join_line(&mut self)
pub fn command_insert_text(&mut self, text: &str)
pub fn command_set_position(&mut self, cursor: Point2<usize>)
pub fn command_set_position_clamped(&mut self, cursor: Point2<usize>)
pub fn command_set_selection(&mut self, start: Point2<i32>, end: Point2<i32>)
pub fn command_select_all(&mut self)
pub fn command_select_all_block_mode(&mut self)
sourcepub fn bump_history(&mut self)
pub fn bump_history(&mut self)
Make a history separator for the undo/redo This is used for breaking undo action list
pub fn command_undo(&mut self)
pub fn command_redo(&mut self)
pub fn is_selected_in_linear_mode(&self, loc: Point2<i32>) -> bool
pub fn is_selected_in_block_mode(&self, loc: Point2<i32>) -> bool
sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
clear the text selection
pub fn selected_text_in_linear_mode(&self) -> Option<String>
pub fn selected_text_in_block_mode(&self) -> Option<String>
pub fn cut_selected_text_in_linear_mode(&mut self) -> Option<String>
sourcepub fn selection_normalized_casted(
&self
) -> Option<(Point2<usize>, Point2<usize>)>
pub fn selection_normalized_casted( &self ) -> Option<(Point2<usize>, Point2<usize>)>
return the selection points which is normalized and casted into usize
pub fn selection_reorder_casted(&self) -> Option<(Point2<usize>, Point2<usize>)>
pub fn cut_selected_text_in_block_mode(&mut self) -> Option<String>
pub fn paste_text_in_block_mode(&mut self, text_block: String)
sourcepub fn command_merge_text(&mut self, text_block: String)
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
pub fn get_position(&self) -> Point2<usize>
pub fn max_position(&self) -> Point2<usize>
pub fn get_content(&self) -> String
pub fn total_lines(&self) -> usize
pub fn lines(&self) -> Vec<String>
sourcepub fn numberline_wide(&self) -> usize
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§
Auto Trait Implementations§
impl RefUnwindSafe for TextEdit
impl Send for TextEdit
impl Sync for TextEdit
impl Unpin for TextEdit
impl UnwindSafe for TextEdit
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
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
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.