Fix insertion of control characters and mode after deleting selection in select mode.