FindEndOfCurrentWord returns an index relative to the cursor position. pointing to the end of the current word. Return 0 if nothing was found.
()
| 189 | // FindEndOfCurrentWord returns an index relative to the cursor position. |
| 190 | // pointing to the end of the current word. Return 0 if nothing was found. |
| 191 | func (d *Document) FindEndOfCurrentWord() int { |
| 192 | x := d.TextAfterCursor() |
| 193 | i := strings.IndexByte(x, ' ') |
| 194 | if i != -1 { |
| 195 | return i |
| 196 | } |
| 197 | return len(x) |
| 198 | } |
| 199 | |
| 200 | // FindEndOfCurrentWordWithSpace is almost the same as FindEndOfCurrentWord. |
| 201 | // The only difference is to ignore contiguous spaces. |