Skip to main content

find_next_word_end

Function find_next_word_end 

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

Finds the end offset of the current word or next word moving forward from cursor_byte.

Behavior matches classic editor Ctrl + Right:

  1. If currently at a newline, advances past the newline.
  2. If currently at non-newline whitespace, skips forward across the whitespace.
  3. Identifies whether the current token is a word or punctuation sequence.
  4. Moves forward across consecutive characters of that same kind.
  5. Returns the ending byte offset of that token.