MCPcopy Index your code
hub / github.com/c-bata/go-prompt / FindEndOfCurrentWordUntilSeparator

Method FindEndOfCurrentWordUntilSeparator

document.go:220–231  ·  view source on GitHub ↗

FindEndOfCurrentWordUntilSeparator is almost the same as FindEndOfCurrentWord. But this can specify Separator. Return 0 if nothing was found.

(sep string)

Source from the content-addressed store, hash-verified

218// FindEndOfCurrentWordUntilSeparator is almost the same as FindEndOfCurrentWord.
219// But this can specify Separator. Return 0 if nothing was found.
220func (d *Document) FindEndOfCurrentWordUntilSeparator(sep string) int {
221 if sep == "" {
222 return d.FindEndOfCurrentWord()
223 }
224
225 x := d.TextAfterCursor()
226 i := strings.IndexAny(x, sep)
227 if i != -1 {
228 return i
229 }
230 return len(x)
231}
232
233// FindEndOfCurrentWordUntilSeparatorIgnoreNextToCursor is almost the same as FindEndOfCurrentWordWithSpace.
234// But this can specify Separator. Return 0 if nothing was found.

Calls 2

FindEndOfCurrentWordMethod · 0.95
TextAfterCursorMethod · 0.95

Tested by 1