Solves problem when pressing arrow up/down and the screen did not scroll...

... up/down. Also fix some issues when setting the caret in the right position. Pressing up/down went into the beginning of the paragraph instead of the paragraph below or above.
Why was 'height/2' and not 'height'? With just 'height' it works better, it solves the problem that when pressing arrow Up the caret goes to the beginning of the paragraph.