Remove trailing spaces in history.