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

Method GetCursorDownPosition

document.go:363–372  ·  view source on GitHub ↗

GetCursorDownPosition return the relative cursor position (character index) where we would be if the user pressed the arrow-down button.

(count int, preferredColumn int)

Source from the content-addressed store, hash-verified

361// GetCursorDownPosition return the relative cursor position (character index) where we would be if the
362// user pressed the arrow-down button.
363func (d *Document) GetCursorDownPosition(count int, preferredColumn int) int {
364 var col int
365 if preferredColumn == -1 { // -1 means nil
366 col = d.CursorPositionCol()
367 } else {
368 col = preferredColumn
369 }
370 row := d.CursorPositionRow() + count
371 return d.TranslateRowColToIndex(row, col) - d.cursorPosition
372}
373
374// Lines returns the array of all the lines.
375func (d *Document) Lines() []string {

Callers 2

CursorDownMethod · 0.80

Calls 3

CursorPositionColMethod · 0.95
CursorPositionRowMethod · 0.95

Tested by 1