[wingide-users] Trim whitespace at end of lines?

Encolpe Degoute encolpe.degoute at free.fr
Mon Aug 29 16:52:29 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wingware Support a écrit :
| On Sat, 27 Aug 2005, Michael Hipp wrote:
|
|>Is there an option somewhere to have the editor automatically trim
whitespace
|>at the end of all lines (probably upon file save)?
|
|
| The following added into scripts/editor_extensions.py should work as
| a way to do it on demand:
|
| def remove_trailing_whitespace(app=wingapi.kArgApplication):
|   """Remove trailing white space in current editor"""
|
|   eol = '\n'
|   def filter(txt):
|     return eol.join([t.rstrip() for t in txt.splitlines()])
|   _buffer_convert(app, filter)
|
| Change eol to the line ending style you want or of course you could
| check the text and restore the same style.
|
| You can bind this to a key binding in preferences or set the contexts
| attribute (see Scripting chapter in docs) to get it into a menu bar
| menu or the editor context menu.

Thanks!

| I've noted your request for doing it automatically all the time.
| Thanks for the suggestion.

All the time, no. but propose to do it like an encoding problem, yes.
For me it's mainly for CVS/SVN logs, and because I like see whitespaces
in the code. I don't know if all users are agree with this point.

King regards,
- --
Encolpe DEGOUTE
http://encolpe.degoute.free.fr/
Logiciels libres, hockey sur glace et autres activités cérébrales
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDE3WNvFPzBBlIZMMRAlUCAJ9chkR7INZFvCC+3xu1SwrBFyPqgwCeKLM/
H1Fq+EPAOn4rME/MhjG9Q7o=
=C2lx
-----END PGP SIGNATURE-----


More information about the wingide-users mailing list