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

Method GetWordBeforeCursorUntilSeparator

document.go:103–106  ·  view source on GitHub ↗

GetWordBeforeCursorUntilSeparator returns the text before the cursor until next separator.

(sep string)

Source from the content-addressed store, hash-verified

101
102// GetWordBeforeCursorUntilSeparator returns the text before the cursor until next separator.
103func (d *Document) GetWordBeforeCursorUntilSeparator(sep string) string {
104 x := d.TextBeforeCursor()
105 return x[d.FindStartOfPreviousWordUntilSeparator(sep):]
106}
107
108// GetWordAfterCursorUntilSeparator returns the text after the cursor until next separator.
109func (d *Document) GetWordAfterCursorUntilSeparator(sep string) string {