Scrollback buffer performance improvment: Keep LineBlock's cached_numlines up to date

Previously, LineBlock's appendLine and dropLines methods would
invalidate its cache of the number of full lines that were in the block,
causing an expensive iteration through the entire block the next time
that information was necessary. This is unnecessary - instead, we can
update the cached_numlines value by examining the line that was just
added or dropped.

This improves the performance of `cat /usr/share/dict/words' on my
machine by about a quarter.