TermBuf::SizeDetector
Stability: internal
Works out how big the terminal is, trying each source in turn and taking the first that answers.
The ioctl comes first because it is exact, free, and needs no cooperation from the terminal. Everything after it is a fallback for the cases where there is no controlling terminal to ask — a pipe, a pty without a size set, a terminal reached across a connection that did not forward one.
Constants
TIOCGWINSZ = 21523_u64
Instance methods
In order: the kernel, the environment, then the shell utilities.
from_commands
stty and tput, which reach the same ioctl by another route. Worth
trying because they may find a controlling terminal this process cannot
see through its own descriptors.
COLUMNS and LINES, which a shell exports and which can be set by hand
when nothing else knows.