Source File
winsize_unix.go
Belonging Package
src.elv.sh/pkg/sys
// +build !windows,!plan9// Copyright 2015 go-termios Author. All Rights Reserved.// https://github.com/go-termios/termios// Author: John Lenton <chipaca@github.com>package sysimport ()// SIGWINCH is the Window size change signal.const SIGWINCH = unix.SIGWINCH// GetWinsize queries the size of the terminal referenced by the given file.func ( *os.File) (, int) {:= int(.Fd()), := unix.IoctlGetWinsize(, unix.TIOCGWINSZ)if != nil {fmt.Printf("error in winSize: %v", )return -1, -1}// Pick up a reasonable value for row and col// if they equal zero in special case,// e.g. serial consoleif .Col == 0 {.Col = 80}if .Row == 0 {.Row = 24}return int(.Row), int(.Col)}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)