Fix bug in visibleLines, which could cause flickering during throw-scroll

Issue #2290