Fix screen resizing bugs introduced by alternate buffers patch

These patches address a handful of bugs to do with screen resizing and the alternate buffer:

* Increasing the number of rows beyond the original screen size causes corruption in the alternate buffer
* The screen blanks until redrawn when resizing while the alternate buffer is current
* Resizing the screen while the alternate buffer is current can crash the app

Lightly tested on a phone running Android 4.4 and various emulators.