Add saving and restoring cursor position.