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.
Add tests for ensuring cached_numlines sanity

If TEST_LINEBUFFER_SANITY is defined, each time we would update the
cached_numlines value outside of the complete refresh case, we would
also calculate the normal refreshed value and log to the console if the
updated value differs from the correct, refreshed value.