pub struct LineGutter { /* private fields */ }Expand description
A line-number gutter for a code editor: the column “1\n2\n3…” drawn top-aligned with the same line height a
TextArea uses, so line n here sits exactly on line n of the editor. Place it beside
the editor inside the same scroll (so they scroll together) and give both the same font_size. It measures
its own width from the widest number and its height from the line count, re-measuring reactively as the
count changes. Toggle it by collapsing its node (set_display) inside a ClippedItem
so a hidden gutter both takes no width and draws nothing.
Implementations§
Source§impl LineGutter
impl LineGutter
pub fn new( line_count: impl Fn() -> usize + 'static, layout_style: LayoutStyle, style_fn: impl Fn() -> TextStyle + 'static, ) -> Result<Self, LayoutError>
Trait Implementations§
Source§impl Component for LineGutter
impl Component for LineGutter
fn view(&self) -> RenderNode
fn on_event(&mut self, _event: &Event) -> EventResult
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Human-readable widget type name for the devtools tree inspector.
Auto Trait Implementations§
impl !RefUnwindSafe for LineGutter
impl !Send for LineGutter
impl !Sync for LineGutter
impl !UnwindSafe for LineGutter
impl Freeze for LineGutter
impl Unpin for LineGutter
impl UnsafeUnpin for LineGutter
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