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

Method Clear

cursor_windows.go:104–118  ·  view source on GitHub ↗

Clear clears the current position and moves the cursor to the left.

()

Source from the content-addressed store, hash-verified

102
103// Clear clears the current position and moves the cursor to the left.
104func (c *Cursor) Clear() {
105 handle := syscall.Handle(c.writer.Fd())
106
107 var csbi consoleScreenBufferInfo
108 _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
109
110 var w uint32
111 cursor := csbi.cursorPosition
112 _, _, _ = procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(1), uintptr(*(*int32)(unsafe.Pointer(&cursor))), uintptr(unsafe.Pointer(&w)))
113
114 if cursor.x > 0 {
115 cursor.x--
116 }
117 _, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor))))
118}

Callers

nothing calls this directly

Calls 1

FdMethod · 0.80

Tested by

no test coverage detected