MCPcopy Create free account
hub / github.com/atomicgo/cursor / move

Method move

cursor_windows.go:31–42  ·  view source on GitHub ↗
(x int, y int)

Source from the content-addressed store, hash-verified

29}
30
31func (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.

Callers 4

UpMethod · 0.95
DownMethod · 0.95
RightMethod · 0.95
LeftMethod · 0.95

Calls 2

shortTypeAlias · 0.85
FdMethod · 0.80

Tested by

no test coverage detected