Smart automatic removal of trailing whitespaces