stop cursor from moving after deleting whitespace