Added resizeToContainer() method to resize the terminal to fill its containing element.

This works on Chromium/Chrome, but hasn't been tested on Firefox or (recent) IE although it should work on those too.
Only drop 1 line out of the scroll back buffer when it is full, don't cut it in half.
Plus some small code improvements to the scroll method.