pub struct EditorState {Show 21 fields
pub show_line_numbers: bool,
pub font_size: Pixels,
pub line_height: Pixels,
pub font_family_override: Option<SharedString>,
pub cursor_color_override: Option<Hsla>,
pub selection_color_override: Option<Hsla>,
pub line_number_color_override: Option<Hsla>,
pub line_number_active_color_override: Option<Hsla>,
pub gutter_bg_override: Option<Hsla>,
pub search_match_color_overrides: Option<(Hsla, Hsla)>,
pub current_line_color_override: Option<Hsla>,
pub bracket_match_color_override: Option<Hsla>,
pub word_highlight_color_override: Option<Hsla>,
pub indent_guide_color_override: Option<Hsla>,
pub indent_guide_active_color_override: Option<Hsla>,
pub fold_marker_color_override: Option<Hsla>,
pub diagnostic_error_color: Option<Hsla>,
pub diagnostic_warning_color: Option<Hsla>,
pub diagnostic_info_color: Option<Hsla>,
pub diagnostic_hint_color: Option<Hsla>,
pub syntax_color_fn: Option<Box<dyn Fn(&str) -> Hsla>>,
/* private fields */
}Fields§
§show_line_numbers: bool§font_size: Pixels§line_height: Pixels§font_family_override: Option<SharedString>§cursor_color_override: Option<Hsla>§selection_color_override: Option<Hsla>§line_number_color_override: Option<Hsla>§line_number_active_color_override: Option<Hsla>§gutter_bg_override: Option<Hsla>§search_match_color_overrides: Option<(Hsla, Hsla)>§current_line_color_override: Option<Hsla>§bracket_match_color_override: Option<Hsla>§word_highlight_color_override: Option<Hsla>§indent_guide_color_override: Option<Hsla>§indent_guide_active_color_override: Option<Hsla>§fold_marker_color_override: Option<Hsla>§diagnostic_error_color: Option<Hsla>§diagnostic_warning_color: Option<Hsla>§diagnostic_info_color: Option<Hsla>§diagnostic_hint_color: Option<Hsla>§syntax_color_fn: Option<Box<dyn Fn(&str) -> Hsla>>Implementations§
Source§impl EditorState
impl EditorState
pub fn new(cx: &mut Context<'_, Self>) -> Self
pub fn set_cursor_position( &mut self, line: usize, col: usize, cx: &mut Context<'_, Self>, )
pub fn set_font_size(&mut self, size: f32, cx: &mut Context<'_, Self>)
pub fn set_font_family( &mut self, family: impl Into<SharedString>, cx: &mut Context<'_, Self>, )
pub fn set_diagnostics( &mut self, diagnostics: Vec<EditorDiagnostic>, cx: &mut Context<'_, Self>, )
pub fn diagnostics(&self) -> &[EditorDiagnostic]
pub fn diagnostics_at_line(&self, line: usize) -> Vec<&EditorDiagnostic>
pub fn content(&self) -> String
pub fn is_empty(&self) -> bool
pub fn line_count(&self) -> usize
pub fn cursor(&self) -> Position
pub fn is_modified(&self) -> bool
pub fn file_path(&self) -> Option<&PathBuf>
pub fn language(&self) -> Language
pub fn syntax_tree(&self) -> Option<&Tree>
pub fn word_at_cursor(&self) -> Option<(String, usize)>
pub fn find_matching_bracket(&self) -> Option<(Position, Position)>
pub fn word_under_cursor_full(&self) -> Option<(String, usize, usize)>
pub fn compute_fold_ranges(&mut self)
pub fn toggle_fold_at_line(&mut self, line: usize, cx: &mut Context<'_, Self>)
pub fn fold_all(&mut self, cx: &mut Context<'_, Self>)
pub fn unfold_all(&mut self, cx: &mut Context<'_, Self>)
pub fn is_line_folded(&self, line: usize) -> bool
pub fn display_lines(&self) -> Rc<Vec<usize>>
pub fn display_line_count(&self) -> usize
pub fn buffer_line_to_display_row(&self, buffer_line: usize) -> Option<usize>
pub fn display_row_to_buffer_line(&self, display_row: usize) -> usize
pub fn fold_ranges(&self) -> &[FoldRange]
pub fn folded_ranges(&self) -> &[FoldRange]
pub fn cursor_screen_position( &self, line_height: Pixels, ) -> Option<Point<Pixels>>
pub fn apply_completion( &mut self, trigger_col: usize, insert_text: &str, cx: &mut Context<'_, Self>, )
pub fn set_content(&mut self, content: &str, cx: &mut Context<'_, Self>)
pub fn set_language(&mut self, lang: Language)
pub fn set_overlay_active_check( &mut self, check: impl Fn(&App) -> bool + 'static, )
pub fn load_file( &mut self, path: impl Into<PathBuf>, cx: &mut Context<'_, Self>, )
pub fn save_to_file( &mut self, path: impl Into<PathBuf>, cx: &mut Context<'_, Self>, ) -> bool
pub fn save(&mut self, cx: &mut Context<'_, Self>) -> bool
pub fn content_version(&self) -> u64
pub fn undo(&mut self, _: &Undo, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn redo(&mut self, _: &Redo, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn move_up( &mut self, _: &MoveUp, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_down( &mut self, _: &MoveDown, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_left( &mut self, _: &MoveLeft, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_right( &mut self, _: &MoveRight, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_word_left( &mut self, _: &MoveWordLeft, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_word_right( &mut self, _: &MoveWordRight, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_to_line_start( &mut self, _: &MoveToLineStart, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_to_line_end( &mut self, _: &MoveToLineEnd, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_to_doc_start( &mut self, _: &MoveToDocStart, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn move_to_doc_end( &mut self, _: &MoveToDocEnd, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn page_up( &mut self, _: &PageUp, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn page_down( &mut self, _: &PageDown, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_up( &mut self, _: &SelectUp, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_down( &mut self, _: &SelectDown, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_left( &mut self, _: &SelectLeft, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_right( &mut self, _: &SelectRight, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_to_line_start( &mut self, _: &SelectToLineStart, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_to_line_end( &mut self, _: &SelectToLineEnd, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn select_all( &mut self, _: &SelectAll, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn backspace( &mut self, _: &Backspace, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn delete(&mut self, _: &Delete, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn delete_word( &mut self, _: &DeleteWord, _: &mut Window, cx: &mut Context<'_, Self>, )
pub fn enter(&mut self, _: &Enter, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn tab(&mut self, _: &Tab, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn copy(&mut self, _: &Copy, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn cut(&mut self, _: &Cut, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn paste(&mut self, _: &Paste, _: &mut Window, cx: &mut Context<'_, Self>)
pub fn selection_text(&self) -> Option<String>
pub fn search_query(&self) -> &str
pub fn search_match_count(&self) -> usize
pub fn current_match_index(&self) -> Option<usize>
pub fn search_case_sensitive(&self) -> bool
pub fn search_use_regex(&self) -> bool
pub fn find_all(&mut self, query: &str, cx: &mut Context<'_, Self>)
pub fn find_next(&mut self, cx: &mut Context<'_, Self>)
pub fn find_previous(&mut self, cx: &mut Context<'_, Self>)
pub fn replace_current(&mut self, replacement: &str, cx: &mut Context<'_, Self>)
pub fn replace_all(&mut self, replacement: &str, cx: &mut Context<'_, Self>)
pub fn invalidate_line_layouts(&mut self, cx: &mut Context<'_, Self>)
pub fn clear_search(&mut self, cx: &mut Context<'_, Self>)
pub fn set_search_case_sensitive( &mut self, val: bool, cx: &mut Context<'_, Self>, )
pub fn set_search_regex(&mut self, val: bool, cx: &mut Context<'_, Self>)
pub fn goto_line(&mut self, line: usize, cx: &mut Context<'_, Self>)
pub fn scroll_horizontal(&mut self, delta: Pixels, cx: &mut Context<'_, Self>)
pub fn scroll_offset_x(&self) -> Pixels
pub fn max_line_width(&self) -> Pixels
Trait Implementations§
Source§impl EntityInputHandler for EditorState
impl EntityInputHandler for EditorState
Source§fn text_for_range(
&mut self,
range_utf16: Range<usize>,
actual_range: &mut Option<Range<usize>>,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> Option<String>
fn text_for_range( &mut self, range_utf16: Range<usize>, actual_range: &mut Option<Range<usize>>, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> Option<String>
See
InputHandler::text_for_range for detailsSource§fn selected_text_range(
&mut self,
_ignore_disabled_input: bool,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> Option<UTF16Selection>
fn selected_text_range( &mut self, _ignore_disabled_input: bool, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> Option<UTF16Selection>
See
InputHandler::selected_text_range for detailsSource§fn marked_text_range(
&self,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> Option<Range<usize>>
fn marked_text_range( &self, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> Option<Range<usize>>
See
InputHandler::marked_text_range for detailsSource§fn unmark_text(&mut self, _window: &mut Window, _cx: &mut Context<'_, Self>)
fn unmark_text(&mut self, _window: &mut Window, _cx: &mut Context<'_, Self>)
See
InputHandler::unmark_text for detailsSource§fn replace_text_in_range(
&mut self,
range_utf16: Option<Range<usize>>,
new_text: &str,
_window: &mut Window,
cx: &mut Context<'_, Self>,
)
fn replace_text_in_range( &mut self, range_utf16: Option<Range<usize>>, new_text: &str, _window: &mut Window, cx: &mut Context<'_, Self>, )
See
InputHandler::replace_text_in_range for detailsSource§fn replace_and_mark_text_in_range(
&mut self,
range_utf16: Option<Range<usize>>,
new_text: &str,
new_selected_range_utf16: Option<Range<usize>>,
_window: &mut Window,
cx: &mut Context<'_, Self>,
)
fn replace_and_mark_text_in_range( &mut self, range_utf16: Option<Range<usize>>, new_text: &str, new_selected_range_utf16: Option<Range<usize>>, _window: &mut Window, cx: &mut Context<'_, Self>, )
See
InputHandler::replace_and_mark_text_in_range for detailsSource§fn bounds_for_range(
&mut self,
_range_utf16: Range<usize>,
_bounds: Bounds<Pixels>,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> Option<Bounds<Pixels>>
fn bounds_for_range( &mut self, _range_utf16: Range<usize>, _bounds: Bounds<Pixels>, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> Option<Bounds<Pixels>>
See
InputHandler::bounds_for_range for detailsSource§fn character_index_for_point(
&mut self,
point: Point<Pixels>,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> Option<usize>
fn character_index_for_point( &mut self, point: Point<Pixels>, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> Option<usize>
See
InputHandler::character_index_for_point for detailsSource§fn accepts_text_input(
&self,
_window: &mut Window,
_cx: &mut Context<'_, Self>,
) -> bool
fn accepts_text_input( &self, _window: &mut Window, _cx: &mut Context<'_, Self>, ) -> bool
See
InputHandler::accepts_text_input for detailsSource§impl Focusable for EditorState
impl Focusable for EditorState
Source§fn focus_handle(&self, _: &App) -> FocusHandle
fn focus_handle(&self, _: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for EditorState
impl Render for EditorState
Auto Trait Implementations§
impl !RefUnwindSafe for EditorState
impl !Send for EditorState
impl !Sync for EditorState
impl !UnwindSafe for EditorState
impl Freeze for EditorState
impl Unpin for EditorState
impl UnsafeUnpin for EditorState
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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