SourceClass CCursorRange
from egui import CCursorRangeclass CCursorRange:A selected text range (could be a range of length zero).
The selection is based on character count (NOT byte count!).
Properties§
@property
def h_pos(self, /) -> float |None§
@h_pos.setter
def h_pos(self, /, h_pos: float |None) -> None§
@property
def primary(self, /) -> CCursor§
@primary.setter
def primary(self, /, primary: CCursor) -> None§
@property
def secondary(self, /) -> CCursor§
@secondary.setter
def secondary(self, /, secondary: CCursor) -> None§
Methods§
Sourcedef as_sorted_char_range(self, /) -> tuple[int, int]§
The range of selected character indices.
Sourcedef contains(self, /, other: CCursorRange) -> bool§
Is self a super-set of the other range?
Sourcedef is_empty(self, /) -> bool§
True if the selected range contains no characters.
Sourcedef is_sorted(self, /) -> bool§
Sourcedef on_event(self, /, os: OperatingSystem, event: Event, galley: Galley, widget_id: Id) -> bool§
Check for events that modify the cursor range.
Returns True if such an event was found and handled.
Sourcedef on_key_press(self, /, os: OperatingSystem, galley: Galley, modifiers: Modifiers, key: Key) -> bool§
Check for key presses that are moving the cursor.
Returns True if we did mutate self.
Source@staticmethod
def one(cursor: CCursor) -> CCursorRange§
The empty range.
Source@staticmethod
def select_all(galley: Galley) -> CCursorRange§
Select all the text in a galley
Sourcedef single(self, /) -> CCursor |None§
If there is a selection, None is returned. If the two ends are the same, that is returned.
Sourcedef slice_str(self, /, text: str) -> str§
def sorted(self, /) -> tuple[CCursor, CCursor]§
Sourcedef sorted_cursors(self, /) -> tuple[CCursor, CCursor]§
returns the two ends ordered