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

Method HorizontalAbsolute

cursor_windows.go:46–61  ·  view source on GitHub ↗

HorizontalAbsolute moves the cursor to n horizontally. The position n is absolute to the start of the line.

(n int)

Source from the content-addressed store, hash-verified

44// HorizontalAbsolute moves the cursor to n horizontally.
45// The position n is absolute to the start of the line.
46func (c *Cursor) HorizontalAbsolute(n int) {
47 handle := syscall.Handle(c.writer.Fd())
48
49 var csbi consoleScreenBufferInfo
50 _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
51
52 var cursor coord
53 cursor.x = short(n)
54 cursor.y = csbi.cursorPosition.y
55
56 if csbi.size.x < cursor.x {
57 cursor.x = csbi.size.x
58 }
59
60 _, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor))))
61}
62
63// Show the cursor if it was hidden previously.
64// Don't forget to show the cursor at least at the end of your application.

Callers

nothing calls this directly

Calls 2

shortTypeAlias · 0.85
FdMethod · 0.80

Tested by

no test coverage detected