Save alt screen

Causes the alternate screen to be preserved.  Not sure if this is required by any specification, but it more closely matches the behavior of xterm, Terminal.app, and putty.

Demonstration:
    `$ man man`             # create an alternate screen
    `$ perl -e '$|=1; print "\e[?47h"; sleep 2; print "\e[?47l";'`

The patch could be made lower-impact.  I refactored a bit as I went, hopefully increasing clarity.

There is a limitation in that the saved alternate screen is wiped on resize.