go-waku/examples/chat2/screen.go

16 lines
274 B
Go
Raw Normal View History

2022-08-15 18:29:59 +00:00
package main
import (
"os"
"golang.org/x/term"
)
func GetTerminalDimensions() (int, int) {
physicalWidth, physicalHeight, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
panic("Could not determine terminal size")
}
return physicalWidth, physicalHeight
}