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

Method GetWordAfterCursor

document.go:83–86  ·  view source on GitHub ↗

GetWordAfterCursor returns the word after the cursor. If we have whitespace after the cursor this returns an empty string.

()

Source from the content-addressed store, hash-verified

81// GetWordAfterCursor returns the word after the cursor.
82// If we have whitespace after the cursor this returns an empty string.
83func (d *Document) GetWordAfterCursor() string {
84 x := d.TextAfterCursor()
85 return x[:d.FindEndOfCurrentWord()]
86}
87
88// GetWordBeforeCursorWithSpace returns the word before the cursor.
89// Unlike GetWordBeforeCursor, it returns string containing space

Calls 2

TextAfterCursorMethod · 0.95
FindEndOfCurrentWordMethod · 0.95