Fix C99 variable declarations.
Correctly handle used scrollback line count == displayed line count.

In this situation, one division results in -NaN which would, uncaught, cause
the scroll handle top to be at INT_MIN. That doesn't make sense.

Instead, since handle height == bar height, force the handle top to be at 0.