github.com/markusbkk/elvish@v0.0.0-20231204143114-91dc52438621/pkg/sys/winsize_windows.go (about) 1 package sys 2 3 import ( 4 "fmt" 5 "os" 6 "syscall" 7 8 "golang.org/x/sys/windows" 9 ) 10 11 // Windows doesn't have SIGCH, so use an impossible value. 12 const sigWINCH = syscall.Signal(-1) 13 14 func winSize(file *os.File) (row, col int) { 15 var info windows.ConsoleScreenBufferInfo 16 err := windows.GetConsoleScreenBufferInfo(windows.Handle(file.Fd()), &info) 17 if err != nil { 18 fmt.Printf("error in winSize: %v", err) 19 return -1, -1 20 } 21 window := info.Window 22 return int(window.Bottom - window.Top), int(window.Right - window.Left) 23 }