v0.4.0: scroll log, worker slots, disk skip, color gradient, parallel export
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//go:build !test
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func termSize() (int, int) {
|
||||
type winsize struct {
|
||||
Rows uint16
|
||||
Cols uint16
|
||||
Xpixels uint16
|
||||
Ypixels uint16
|
||||
}
|
||||
var ws winsize
|
||||
_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, uintptr(syscall.Stdout), syscall.TIOCGWINSZ, uintptr(unsafe.Pointer(&ws)))
|
||||
if errno != 0 || ws.Cols == 0 || ws.Rows == 0 {
|
||||
return 80, 24
|
||||
}
|
||||
return int(ws.Cols), int(ws.Rows)
|
||||
}
|
||||
Reference in New Issue
Block a user