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

Function find_word_at_visual

src/text_input.rs:2580–2585  ·  view source on GitHub ↗

Find word at a visual position (for double-click selection). Returns (start, end) in visual positions.

(raw: &str, visual_pos: usize)

Source from the content-addressed store, hash-verified

2578 /// Find word at a visual position (for double-click selection).
2579 /// Returns (start, end) in visual positions.
2580 pub fn find_word_at_visual(raw: &str, visual_pos: usize) -> (usize, usize) {
2581 let cp = cursor_to_content(raw, visual_pos);
2582 let stripped = strip_styling(raw);
2583 let (s, e) = super::find_word_at(&stripped, cp);
2584 (content_to_cursor(raw, s, false), content_to_cursor(raw, e, false))
2585 }
2586
2587 /// Count the number of hard lines (\n-separated) in a styled raw string.
2588 pub fn styled_line_count(raw: &str) -> usize {

Callers 1

select_word_at_styledMethod · 0.85

Calls 4

cursor_to_contentFunction · 0.85
strip_stylingFunction · 0.85
find_word_atFunction · 0.85
content_to_cursorFunction · 0.85

Tested by

no test coverage detected