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

Method CurrentLineBeforeCursor

document.go:256–259  ·  view source on GitHub ↗

CurrentLineBeforeCursor returns the text from the start of the line until the cursor.

()

Source from the content-addressed store, hash-verified

254
255// CurrentLineBeforeCursor returns the text from the start of the line until the cursor.
256func (d *Document) CurrentLineBeforeCursor() string {
257 s := strings.Split(d.TextBeforeCursor(), "\n")
258 return s[len(s)-1]
259}
260
261// CurrentLineAfterCursor returns the text from the cursor until the end of the line.
262func (d *Document) CurrentLineAfterCursor() string {

Calls 1

TextBeforeCursorMethod · 0.95