CursorGoTo sets the cursor position where subsequent text will begin.
(row, col int)
| 76 | |
| 77 | // CursorGoTo sets the cursor position where subsequent text will begin. |
| 78 | func (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. |
| 94 | func (w *VT100Writer) CursorUp(n int) { |