pub struct CodeEditorData {
pub rope: Rope,
pub language_id: LanguageId,
/* private fields */
}Fields§
§rope: Rope§language_id: LanguageIdImplementations§
Source§impl CodeEditorData
impl CodeEditorData
pub fn new(rope: Rope, language_id: LanguageId) -> Self
pub fn is_edited(&self) -> bool
pub fn mark_as_saved(&mut self)
pub fn parse(&mut self)
pub fn measure(&mut self, font_size: f32)
pub fn set_theme(&mut self, theme: SyntaxTheme)
pub fn process(&mut self, font_size: f32, edit_event: EditableEvent<'_>) -> bool
Trait Implementations§
Source§impl Display for CodeEditorData
impl Display for CodeEditorData
Source§impl TextEditor for CodeEditorData
impl TextEditor for CodeEditorData
type LinesIterator<'a> = LinesIterator<'a> where Self: 'a
Source§fn lines(&self) -> Self::LinesIterator<'_>
fn lines(&self) -> Self::LinesIterator<'_>
Iterator over all the lines in the text.
Source§fn insert_char(&mut self, ch: char, idx: usize) -> usize
fn insert_char(&mut self, ch: char, idx: usize) -> usize
Insert a character in the text in the given position.
Source§fn insert(&mut self, text: &str, idx: usize) -> usize
fn insert(&mut self, text: &str, idx: usize) -> usize
Insert a string in the text in the given position.
Source§fn char_to_line(&self, char_idx: usize) -> usize
fn char_to_line(&self, char_idx: usize) -> usize
Get line from the given char
Source§fn line_to_char(&self, line_idx: usize) -> usize
fn line_to_char(&self, line_idx: usize) -> usize
Get the first char from the given line
fn utf16_cu_to_char(&self, utf16_cu_idx: usize) -> usize
fn char_to_utf16_cu(&self, idx: usize) -> usize
Source§fn len_utf16_cu(&self) -> usize
fn len_utf16_cu(&self) -> usize
Total of utf16 code units
fn has_any_selection(&self) -> bool
fn get_selection(&self) -> Option<(usize, usize)>
fn set(&mut self, text: &str)
fn clear_selection(&mut self)
fn set_selection(&mut self, (from, to): (usize, usize))
fn get_selected_text(&self) -> Option<String>
fn get_selection_range(&self) -> Option<(usize, usize)>
fn undo(&mut self) -> Option<TextSelection>
fn redo(&mut self) -> Option<TextSelection>
fn editor_history(&mut self) -> &mut EditorHistory
Source§fn selection(&self) -> &TextSelection
fn selection(&self) -> &TextSelection
Get a readable text selection
Source§fn selection_mut(&mut self) -> &mut TextSelection
fn selection_mut(&mut self) -> &mut TextSelection
Get a mutable reference to text selection
fn get_indentation(&self) -> u8
Source§fn cursor_row(&self) -> usize
fn cursor_row(&self) -> usize
Get the cursor row
Source§fn cursor_col(&self) -> usize
fn cursor_col(&self) -> usize
Get the cursor column
Source§fn cursor_down(&mut self) -> bool
fn cursor_down(&mut self) -> bool
Move the cursor 1 line down
Source§fn cursor_right(&mut self) -> bool
fn cursor_right(&mut self) -> bool
Move the cursor 1 char to the right
Source§fn cursor_left(&mut self) -> bool
fn cursor_left(&mut self) -> bool
Move the cursor 1 char to the left
Source§fn cursor_pos(&self) -> usize
fn cursor_pos(&self) -> usize
Get the cursor position
Source§fn move_cursor_to(&mut self, pos: usize)
fn move_cursor_to(&mut self, pos: usize)
Move the cursor position
fn get_visible_selection( &self, editor_line: EditorLine, ) -> Option<(usize, usize)>
fn measure_selection(&self, to: usize, line_index: EditorLine) -> TextSelection
fn process_key( &mut self, key: &Key, modifiers: &Modifiers, allow_tabs: bool, allow_changes: bool, allow_clipboard: bool, ) -> TextEvent
fn find_word_boundaries(&self, pos: usize) -> (usize, usize)
Auto Trait Implementations§
impl Freeze for CodeEditorData
impl RefUnwindSafe for CodeEditorData
impl Send for CodeEditorData
impl Sync for CodeEditorData
impl Unpin for CodeEditorData
impl UnsafeUnpin for CodeEditorData
impl UnwindSafe for CodeEditorData
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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