Better job of handling tap beyond end of document.

We're now moving the caret to the start of the appropriate line, but this
results in some janky scrolling when there's a few line breaks at the end of
the document.