Some languages have a trim-indent command but don't use it (for no apparent reason). Make them trim trailing spaces when exiting insert mode, like most other languages support scripts do.
Fixes the bug described by PR #1994