Force preview to scroll to the end

fixes #958, fixes #535

- If the cursor is within the last 5 lines, then scroll to the end of the preview window, rather than using a ratio
Merge pull request #2437 from ErisDS/cm-scroll

Force preview to scroll to the end