MCPcopy
hub / github.com/c-bata/go-prompt / FindEndOfCurrentWordWithSpace

Method FindEndOfCurrentWordWithSpace

document.go:202–216  ·  view source on GitHub ↗

FindEndOfCurrentWordWithSpace is almost the same as FindEndOfCurrentWord. The only difference is to ignore contiguous spaces.

()

Source from the content-addressed store, hash-verified

200// FindEndOfCurrentWordWithSpace is almost the same as FindEndOfCurrentWord.
201// The only difference is to ignore contiguous spaces.
202func (d *Document) FindEndOfCurrentWordWithSpace() int {
203 x := d.TextAfterCursor()
204
205 start := istrings.IndexNotByte(x, ' ')
206 if start == -1 {
207 return len(x)
208 }
209
210 end := strings.IndexByte(x[start:], ' ')
211 if end == -1 {
212 return len(x)
213 }
214
215 return start + end
216}
217
218// FindEndOfCurrentWordUntilSeparator is almost the same as FindEndOfCurrentWord.
219// But this can specify Separator. Return 0 if nothing was found.

Calls 1

TextAfterCursorMethod · 0.95