fix cursor position when change edit mode