Force preview to scroll to the end

This one has been bugging me for a while!

fixes #958 and fixes #535

Except, it seems it can still get a bit stuck if the last thing you have in your editor is an image, and the image is slightly off screen.

- If the cursor is within the last 5 lines, then scroll to the end of the preview window, rather than using a ratio