Rewrote on_save to just delete trailing spaces, rather than replace entire document with stripped text.