Skip to main content

find_word_range_at

Function find_word_range_at 

Source
pub fn find_word_range_at(text: &Rope, cursor_byte: usize) -> Range<usize>
Expand description

Finds the byte range of the word, punctuation token, or whitespace run containing cursor_byte.

If cursor_byte points to whitespace or a line break immediately following a word or punctuation token on the same line, the preceding token is selected. Otherwise, the continuous token of the same CharKind spanning cursor_byte is returned, never crossing line boundaries.