Skip to content

TextSelection

TextSelection #

A range of text that represents a selection.

affinity #

affinity: TextAffinity | None = None

If the text range is collapsed and has more than one visual location (e.g., occurs at a line break), which of the two locations to use when painting the caret.

base_offset #

base_offset: int | None = None

The offset at which the selection originates.

collapsed #

collapsed: bool | None = None

Whether this range is empty (but still potentially placed inside the text).

directional #

directional: bool | None = None

Whether this selection has disambiguated its base and extent.

end #

end: int | None = None

The next index after the characters in this range.

extent_offset #

extent_offset: int | None = None

The offset at which the selection terminates.

normalized #

normalized: bool | None = None

Whether the start of this range precedes the end.

selection #

selection: str | None = None

The text string that is selected.

start #

start: int | None = None

The index of the first character in the range.

valid #

valid: bool | None = None

Whether this range represents a valid position in the text.