pub struct EditorConfig {Show 13 fields
pub line_numbers: bool,
pub line_height: Pixels,
pub font_size: Pixels,
pub tab_size: usize,
pub highlight_active_line: bool,
pub block_cursor: bool,
pub cursor_blink: bool,
pub context_menu: bool,
pub show_default_menu_items: bool,
pub line_wrap: bool,
pub font_family: Option<SharedString>,
pub code_font_family: Option<SharedString>,
pub markdown: MarkdownConfig,
}Expand description
Layout and visual settings for the editor canvas.
Fields§
§line_numbers: boolWhether to render line numbers in the left gutter.
line_height: PixelsVertical line height in pixels.
font_size: PixelsText font size in pixels.
tab_size: usizeNumber of spaces per tab indentation.
highlight_active_line: boolWhether to highlight the background of the active cursor line.
block_cursor: boolDefault cursor shape: true for block, false for line/bar.
cursor_blink: boolWhether the cursor should blink when focused.
Whether right-click opens the expandable context menu.
Whether the built-in edit rows (Undo/Redo/Cut/Copy/Paste/Delete/Select All) lead the context menu. Hooks always append after them.
line_wrap: boolWhether to soft-wrap lines at the viewport boundary.
font_family: Option<SharedString>Base font family override (None auto-selects, see below).
When unset, the editor probes Self::platform_monospace_candidates
at paint time and uses the first family with bold + italic faces. An
explicitly set family is trusted verbatim (still probed, so
Editor::face_availability stays truthful). Missing faces fall back
silently at the OS level, which is why auto-select exists.
code_font_family: Option<SharedString>Font family for Code spans (None reuses the base family).
markdown: MarkdownConfigMarkdown WYSIWYG and syntax configuration.
Implementations§
Source§impl EditorConfig
impl EditorConfig
Sourcepub fn platform_monospace_candidates() -> Vec<SharedString>
pub fn platform_monospace_candidates() -> Vec<SharedString>
Ordered monospace fallback families for font auto-select.
Ordered by likelihood of shipping full (regular/bold/italic/bold-italic) faces: a partial set (e.g. regular+bold only) can never satisfy emphasis, so completeness outranks name recognition.
Sourcepub fn font_candidates(&self) -> Vec<SharedString>
pub fn font_candidates(&self) -> Vec<SharedString>
Candidate families for auto-select: the explicit family alone when set, otherwise the platform list.
Sourcepub fn pick_family(
candidates: &[SharedString],
probe: impl FnMut(&str) -> (bool, bool),
) -> Option<&SharedString>
pub fn pick_family( candidates: &[SharedString], probe: impl FnMut(&str) -> (bool, bool), ) -> Option<&SharedString>
Picks the first candidate with bold + italic faces (else the first with
either, else None). Pure to stay headless-testable; callers pass a
probe comparing resolved FontIds.
Sourcepub fn base_font(&self, host: &Font, selected: Option<&SharedString>) -> Font
pub fn base_font(&self, host: &Font, selected: Option<&SharedString>) -> Font
Resolves the base font: explicit family, else auto-selected family, else host.
Sourcepub fn code_font(&self, host: &Font, selected: Option<&SharedString>) -> Font
pub fn code_font(&self, host: &Font, selected: Option<&SharedString>) -> Font
Resolves the font for Code spans: explicit code family, else whatever
Self::base_font resolves (so code follows auto-select by default).
Trait Implementations§
Source§impl Clone for EditorConfig
impl Clone for EditorConfig
Source§fn clone(&self) -> EditorConfig
fn clone(&self) -> EditorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EditorConfig
impl Debug for EditorConfig
Auto Trait Implementations§
impl Freeze for EditorConfig
impl RefUnwindSafe for EditorConfig
impl Send for EditorConfig
impl Sync for EditorConfig
impl Unpin for EditorConfig
impl UnsafeUnpin for EditorConfig
impl UnwindSafe for EditorConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().