fix editor cursor repositioning issue