FindStartOfPreviousWordWithSpace is almost the same as FindStartOfPreviousWord. The only difference is to ignore contiguous spaces.
()
| 139 | // FindStartOfPreviousWordWithSpace is almost the same as FindStartOfPreviousWord. |
| 140 | // The only difference is to ignore contiguous spaces. |
| 141 | func (d *Document) FindStartOfPreviousWordWithSpace() int { |
| 142 | x := d.TextBeforeCursor() |
| 143 | end := istrings.LastIndexNotByte(x, ' ') |
| 144 | if end == -1 { |
| 145 | return 0 |
| 146 | } |
| 147 | |
| 148 | start := strings.LastIndexByte(x[:end], ' ') |
| 149 | if start == -1 { |
| 150 | return 0 |
| 151 | } |
| 152 | return start + 1 |
| 153 | } |
| 154 | |
| 155 | // FindStartOfPreviousWordUntilSeparator is almost the same as FindStartOfPreviousWord. |
| 156 | // But this can specify Separator. Return 0 if nothing was found. |