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

Method GetWordBeforeCursorUntilSeparatorIgnoreNextToCursor

document.go:116–119  ·  view source on GitHub ↗

GetWordBeforeCursorUntilSeparatorIgnoreNextToCursor returns the word before the cursor. Unlike GetWordBeforeCursor, it returns string containing space

(sep string)

Source from the content-addressed store, hash-verified

114// GetWordBeforeCursorUntilSeparatorIgnoreNextToCursor returns the word before the cursor.
115// Unlike GetWordBeforeCursor, it returns string containing space
116func (d *Document) GetWordBeforeCursorUntilSeparatorIgnoreNextToCursor(sep string) string {
117 x := d.TextBeforeCursor()
118 return x[d.FindStartOfPreviousWordUntilSeparatorIgnoreNextToCursor(sep):]
119}
120
121// GetWordAfterCursorUntilSeparatorIgnoreNextToCursor returns the word after the cursor.
122// Unlike GetWordAfterCursor, it returns string containing space