MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / selection_range

Method selection_range

src/text_input.rs:87–93  ·  view source on GitHub ↗

Returns the ordered selection range `(start, end)` if a selection is active.

(&self)

Source from the content-addressed store, hash-verified

85impl TextEditState {
86 /// Returns the ordered selection range `(start, end)` if a selection is active.
87 pub fn selection_range(&self) -> Option<(usize, usize)> {
88 self.selection_anchor.map(|anchor| {
89 let start = anchor.min(self.cursor_pos);
90 let end = anchor.max(self.cursor_pos);
91 (start, end)
92 })
93 }
94
95 /// Returns the selected text, or empty string if no selection.
96 pub fn selected_text(&self) -> &str {

Callers 11

get_selection_rangeMethod · 0.80
selected_textMethod · 0.80
delete_selectionMethod · 0.80
move_leftMethod · 0.80
move_rightMethod · 0.80
selected_text_styledMethod · 0.80
move_left_styledMethod · 0.80
move_left_contentMethod · 0.80
move_right_styledMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected