Keeping cursor position after updating