Save the cursor position and the display offset