Improved cursor movement

Added cursor movement to keep the cursor on the "same" line. Not correct
behaviour but better than before.
The cursor shouldn't move until it reaches the start or end of the page
but currently moves every time.