Implement saved state so that cursor goes back to the right place when screen is rotated.