| 29 | } |
| 30 | |
| 31 | func (c *Cursor) move(x int, y int) { |
| 32 | handle := syscall.Handle(c.writer.Fd()) |
| 33 | |
| 34 | var csbi consoleScreenBufferInfo |
| 35 | _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) |
| 36 | |
| 37 | var cursor coord |
| 38 | cursor.x = csbi.cursorPosition.x + short(x) |
| 39 | cursor.y = csbi.cursorPosition.y + short(y) |
| 40 | |
| 41 | _, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor)))) |
| 42 | } |
| 43 | |
| 44 | // HorizontalAbsolute moves the cursor to n horizontally. |
| 45 | // The position n is absolute to the start of the line. |