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

Method CursorGoTo

output_vt100.go:78–91  ·  view source on GitHub ↗

CursorGoTo sets the cursor position where subsequent text will begin.

(row, col int)

Source from the content-addressed store, hash-verified

76
77// CursorGoTo sets the cursor position where subsequent text will begin.
78func (w *VT100Writer) CursorGoTo(row, col int) {
79 if row == 0 && col == 0 {
80 // If no row/column parameters are provided (ie. <ESC>[H), the cursor will move to the home position.
81 w.WriteRaw([]byte{0x1b, '[', 'H'})
82 return
83 }
84 r := strconv.Itoa(row)
85 c := strconv.Itoa(col)
86 w.WriteRaw([]byte{0x1b, '['})
87 w.WriteRaw([]byte(r))
88 w.WriteRaw([]byte{';'})
89 w.WriteRaw([]byte(c))
90 w.WriteRaw([]byte{'H'})
91}
92
93// CursorUp moves the cursor up by 'n' rows; the default count is 1.
94func (w *VT100Writer) CursorUp(n int) {

Callers

nothing calls this directly

Calls 1

WriteRawMethod · 0.95

Tested by

no test coverage detected