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

Method GetWordBeforeCursor

document.go:76–79  ·  view source on GitHub ↗

GetWordBeforeCursor returns the word before the cursor. If we have whitespace before the cursor this returns an empty string.

()

Source from the content-addressed store, hash-verified

74// GetWordBeforeCursor returns the word before the cursor.
75// If we have whitespace before the cursor this returns an empty string.
76func (d *Document) GetWordBeforeCursor() string {
77 x := d.TextBeforeCursor()
78 return x[d.FindStartOfPreviousWord():]
79}
80
81// GetWordAfterCursor returns the word after the cursor.
82// If we have whitespace after the cursor this returns an empty string.

Callers 9

newChoiceCompleterFunction · 0.80
CompleteMethod · 0.80
completerFuncFunction · 0.80
completerFunction · 0.80
completerFunction · 0.80
completerFunction · 0.80
completerFunction · 0.80

Calls 2

TextBeforeCursorMethod · 0.95