I can't quite remember exactly when this changed, I think most likely during the transition from 10.2 to 10.3, but I'm no longer sure. In any case, Terminal
used to behave in a (to me) reasonable manner when using such applications as vi, less and top. These programs and probably others will use the (emulated, e.g., xterm) terminal's "alternate screen buffer" if available while they do their work, and restore the previous screen contents when they exit. The problem is that most of the time, I don't want them to do this. In fact, I want just the opposite, especially if i want to scroll back through that man page I just read, etc.
The Problem:
Back in the 10.2 (?) days, this wasn't an issue -- for whatever reason (my guess being differences in the terminfo database), this alternate screen business was ignored, and one could see the work left behind by exiting programs. With Panther, and its incorporation of significant Linux influences, this behavior changed, much to my disappointment. Suddenly, one-too-many presses of the space bar and man pages were disappearing, pids that top revealed as needing to be killed were no longer visible after hitting "q" -- a whole litany of annoyances cropped up.
A solution:
I have seen various suggestions in various places regarding remedies, but none of them have been optimal. Some fixed the problem, but caused others
equally irritating. Finally over Christmas, I found the time to play around a bit, and created an alternate terminfo entry for xterm-color.
What it does:
My slightly altered xterm-color has the following beneficial (at least to me) effects:
xterm-color entry in the terminfo database, we can alter the capabilities which tell programs the character sequences
to send to the Terminal to begin and end the use of the alternate screen buffer. If we then tell Terminal to use our new terminfo entry, its xterm-color emulation will take on the behavior specified by the altered entry. In the replaced entry, only the smcup and rmcup capabilities have been changed; it is otherwise exactly the same as Apple's xterm-color which shipped with Panther.
./78/xterm-color
If not, replace 78 in the following with whatever directory your xterm-color entry was in.$ cd 78
$ sudo cp xterm-color xterm-color.apple
Obviously, use whatever name you want for the backup.Mac OS X Hints
http://hints.macworld.com/article.php?story=2004122710403854