Skip to main content

LineDecorationProvider

Trait LineDecorationProvider 

Source
pub trait LineDecorationProvider {
    // Required method
    fn line_decorations(
        &self,
        rows: Range<usize>,
        cx: &App,
    ) -> Vec<LineDecoration>;

    // Provided method
    fn has_gutter_icons(&self) -> bool { ... }
}
Expand description

Supplies the line decorations of the rows an editor paints.

The editor asks on every frame with the visible buffer rows and ignores decorations outside them, so an implementation must be cheap. Colors may be read from cx, so they follow theme changes.

Required Methods§

Source

fn line_decorations(&self, rows: Range<usize>, cx: &App) -> Vec<LineDecoration>

Return the decorations for rows within rows.

Provided Methods§

Source

fn has_gutter_icons(&self) -> bool

Whether this provider’s decorations have gutter icons. Default is false.

While a provider says it has them and the line numbers are shown, the gutter reserves the column of the gutter icons for every row, so the gutter keeps its width as rows with an icon scroll in and out of view. The gutter icons of other providers are not painted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§