[TxMt] Stray whitespace

Xavier Noria fxn at hashref.com
Sun Dec 4 13:05:06 UTC 2005


On Dec 4, 2005, at 13:35, Matt Mower wrote:

> Hi folks,
>
> I quite often seem to find stray whitepsace at the end of my lines
> when I'm editing Ruby code.  I'm reasonably certain that I'm not going
> around adding a tab here or there to the end of lines (it's not every
> line).
>
> It doesn't seem to be harmful but, as a neat freak, I find it
> distressing.

Agreed.

> I assume that it's TxMt that's adding it because I can't
> think where else it can be coming from.  Does anyone else see this?

Yes, what I see is that if ENTER produces an indented line, and I  
press ENTER again to leave a blank line, the "blank" line keeps the  
whitespace. Strictly speaking it makes sense.

In practice, though, blank lines that are not equal to "\n" look  
suspicious in general to me. Specially editing Python, where  
whitespace is so important:

    def foo():
        print "foo"

    def bar():
        print "bar"

If you hitted the backspace in the second def line, the blank line is  
not blank. It does not introduce an error, but the fact is that I  
find it counter-intuitive. And that applies to non-Python as well for  
me.

> Does anyone know how to stop it?

Since the behaviour is correct, because if I put there an indent the  
editor cannot assume I didn't actually want it, maybe I would like to  
have that standard feature which is to be able to configure the  
editor to strip trailing whitespace on saving.

-- fxn




More information about the textmate mailing list