Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrGetWinsizeFailed = errors.New("term: syscall.TIOCGWINSZ failed")
ErrGetWinsizeFailed indicates that the system call to extract the size of a Unix tty from the kernel failed.
Functions ¶
This section is empty.
Types ¶
type Size ¶
Size is the size of a terminal, expressed in character cells, as Lines and Columns. This might come from environment variables or OS-dependent resources.
func GetEnvWindowSize ¶
func GetEnvWindowSize() *Size
GetEnvWindowSize returns the window Size, as determined by process environment; if either LINES or COLUMNS is present, and whichever is present is also numeric, the Size will be non-nil. If Size is nil, there's insufficient data in environ. If one entry is 0, that means that the environment does not include that data. If a value is negative, we treat that as an error.
func GetSize ¶
GetSize will return the terminal window size.
We prefer environ $LINES/$COLUMNS, then fall back to tty-held information. We do not support use of termcap/terminfo to derive default size information.
func GetTerminalWindowSize ¶
GetTerminalWindowSize returns the terminal size maintained by the kernel for a Unix TTY, passed in as an *os.File. This information can be seen with the stty(1) command, and changes in size (eg, terminal emulator resized) should trigger a SIGWINCH signal delivery to the foreground process group at the time of the change, so a long-running process might reasonably watch for SIGWINCH and arrange to re-fetch the size when that happens.