Scroll position fix - take 2

This is for issue #2774.

I added range checking on setScrollPos(). This fixes the worst part of the problem which is part of the screen being blank.

This does not fix the unnecessary scroll when "b" is typed, which is not critical, and a bit trickier to fix without breaking other "center on scroll" cases.