Skip to main content

rail

Function rail 

Source
pub fn rail(
    id: impl Into<SharedString>,
    handle: &ScrollHandle,
    count: usize,
    room: Pixels,
) -> AnyElement
Expand description

A mark per item, the one at the top of the viewport lit — for a pane whose content comes in countable pieces (a transcript’s turns) rather than as one continuous document, where how far down you are matters less than which piece you are on. A press jumps to that piece.

count addresses the direct children of the track_scroll element, which is what gpui indexes: a pane whose pieces sit nested inside a wrapper reports one child, and every mark would scroll to the same place.

Absolute, so the caller’s container holds the position: pin it with .relative() on whichever box the rail belongs to the edge of.

room is the clear space beside the content, which only the caller can measure — the rail paints nothing under RAIL_ROOM, because marks over the text would be worse than no marks at all.