gnachman/iTerm2 — pull request #131 by rolandwalker (2013-06-30 03:06:01+00:00)
Title: 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.