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

Little Girl littlergirl at xxxxx
Mon Sep 4 00:49:53 UTC 2017

Hey there,

Matthew Brush wrote:
> On 2017-09-03 11:05 AM, Little Girl wrote:

> > Edit --> Preferences --> Files --> Saving files --> Strip trailing
> > spaces and tabs


> > If you put your cursor on a blank line and tab over three times
> > and save the file, Geany strips those three tabs out even though
> > they're leading tabs (they're not trailing after anything).
> It's by design, though both ways have their pros and cons.

Yep, I had figured that might be the case.

> If I remember correctly VisualStudio has a nice (if complicated to 
> implement) solution, it never saved the superfluous whitespaces,
> but graphically, in the editor it appeared to leave them alone so
> it didn't cause you to re-indent while editing after a save.

That doesn't sound like it would quite be a solution, either.
> > What I'd like is for Geany to only strip trailing spaces or tabs
> > from lines that also contain something other than tabs or spaces.
> > Is there any chance that that's what was intended and that it
> > just needs fixing or is it behaving as intended?
> It could be made an option, for example as in this this pull
> request:
> https://github.com/geany/geany/pull/128

That might be nice.
> Of course it would take someone to update it and try and get it
> merged.

Maybe someone will at some point.

> Speaking only for myself, I'd never use this option/feature, and
> so, with my limited time, have never dedicated any towards
> reviewing and merging it.

Please don't do it on my account. I haven't used it in the past,
just messed around with it today, and can continue on as I've been

> You could also do as John mentioned and write a little script to do
> it as you like, and you could even make it a command for "Send
> Selection to Command" so that you could do <Ctrl>+a, <Ctrl>+1,
> <Ctrl>+s to strip the whole file while saving, to your preference.
> For inspiration, there is a script in Geany's scripts directory
> called `rstrip-whitespace.py` which could be trivially adapted to
> do as above.

Thanks. I'll take a look.

Little Girl

There is no spoon.

More information about the Users mailing list