[Geany-Users] Possible unintentional behavior when stripping trailing spaces and tabs

John Yeung gallium.arsenide at xxxxx
Sun Sep 3 18:33:51 UTC 2017


It's working as intended.

When people say "trailing" they usually mean "at the end of the line".
And certainly if a line only has whitespace, then ALL of the
whitespace on that line should be considered BOTH leading AND
trailing.

Philosophically, if you consider a "saved file" as a finished product,
then it makes sense that there would be no lines with only whitespace.

I personally wouldn't want there to be saved whitespace which only
exists to allow the cursor to go there simply because the cursor
happens to be there at save time. The only argument that might sway me
is that whitespace *up to the current indent level* should be
preserved. This would be more complicated and possibly unreliable
(what if the file isn't properly/consistently indented?) than simply
removing all end-of-line whitespace; and as far as I can tell, pretty
nonstandard among editors.

I think the best setup for you, given your preferences, would be to
not have Geany automatically strip whitespace, but to write a script
that goes through a file (or a whole project) and strips the
whitespace that *you* want to strip. You would of course run this
script manually yourself every so often, or include it in your commit
process, or make a Geany plugin for it, etc.

John Y.


More information about the Users mailing list