clamp_selection(
widget: Widget,
selection: Selection,
) -> Selection | None| Name | Type | Description |
|---|---|---|
widget* | Widget | The row the selection applies to. Anything that is not a
|
selection* | Selection | The geometry Textual computed for this row. |
Return selection shifted past a diff row's gutter, if one is set.
Every form a selection can take over a single-line row covers the gutter unless its start is moved past it:
Selection(None, None) — the row sits mid-selection. Textual extracts
the row's full text, so the start must move to the gutter's end even
though no endpoint lands here.Selection(None, end) — entered from above; same move, plus an end
still inside the gutter means nothing selectable is covered, reported
as None so the row drops out of the screen's selection map.Selection(start, None) / Selection(start, end) — pull any endpoint
inside the gutter forward to its end; a range that then collapses
(wholly gutter) is None.Endpoints arrive as offsets into the row's logical content, not as visual
screen coordinates, because every strip carries its own offset metadata.
A wrapped row's continuations therefore need no rule of their own: their
offsets — including the ones their synthetic gutter maps to — all land at
or past prefix_len, so the gutter tests below cannot fire on them.