update whitespace trimming and ctrl-p buffer re-opening