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

Method TextBeforeCursor

document.go:63–66  ·  view source on GitHub ↗

TextBeforeCursor returns the text before the cursor.

()

Source from the content-addressed store, hash-verified

61
62// TextBeforeCursor returns the text before the cursor.
63func (d *Document) TextBeforeCursor() string {
64 r := []rune(d.Text)
65 return string(r[:d.cursorPosition])
66}
67
68// TextAfterCursor returns the text after the cursor.
69func (d *Document) TextAfterCursor() string {

Calls

no outgoing calls

Tested by 2