The problem is likely that the program does not know what the correct screensize is. Usually the system can get this information from the terminal program. But sometimes it cannot, or it is overridden.
Assuming that you are using some unix-like system, the stty
command can show what the system thinks the screensize is, e.g.,
$ stty -a speed 38400 baud; rows 40; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke $
The rows
and columns
values are what the system thinks the screensize is. If that is wrong, you can use stty
to change them, e.g.,
stty rows 50 columns 132
but a better way is using resize
(just by running it, it calls the same interface that stty
reads).
However, stty
may show correct values. Your environment may override its settings with the LINES
and/or COLUMNS
environment variables. (Those are longstanding legacy crutches for termcap applications). Just unsetting those variables fixes that problem.
Further reading:
- RFC 1073 - NAWS (Negotiate About Window Size)
- resize(1)
- use_env(3) describes the environment variables
- stty(1) tells how to set/get terminal settings