Skip to main content

render_with_selection

Function render_with_selection 

Source
pub fn render_with_selection(
    doc: &Doc,
    selection: Option<Selection>,
    layouts: Option<&BlockLayouts>,
    placeholder: Option<SharedString>,
    window: &mut Window,
    cx: &mut App,
) -> AnyElement
Expand description

Render a document with a caret and a selection in it.

Both are paint-time concerns and nothing else: they read their positions off the shaped text’s own layout handle, the same way the inline-code wash does, so nothing about layout depends on where the caret sits. An editor supplies the selection and owns the focus and the keys; painting a caret and a few quads is not worth a second renderer.