Separated common into common and support (non-terminal specific code)
Make ASSERT conditional on DEBUG.
Fix valgrind uninitialized error.
Adjust the cursor position during resize.
During resize change cols before rows to avoid superfluous resizes.
Resize strategy - remove trailing blank lines.
Misc cleanups and comments.