[Geany] spaces, tabs and saving

Harold Aling h.aling at xxxxx
Thu Jun 7 08:52:06 UTC 2007


John Gabriele wrote:
>
>> So, I can confirm that replacing tabs with spaces is a bit 'buggy' at
>> least...
>
> Can you describe what exactly happened? In the past, the Geany
> developers have been quite responsive to detailed bug reports.
OK... Fair enough...

1. sudo geany /usr/lib/python2.5/site-packages/sonata.py
2. set Geany to replace tabs with spaces
3. save the file
4. run it (/usr/bin/sonata)

harold at DBWS439:~$ sonata
Traceback (most recent call last):
  File "/usr/bin/sonata", line 28, in <module>
    import sonata
  File "/usr/lib/python2.5/site-packages/sonata.py", line 208
    sys.exit()
             ^
IndentationError: unindent does not match any outer indentation level

---

The original source: (s=space, t=tab)

ttLine 206
stttLine 207
sttLine 208

This indentation is visibly aligned correctly and python doesn't 
complain about it, but it's incorrectly corrected by Geany upon save ;)

ssssssssLine 206
sssssssssssssLine 207
sssssssssLine 208

The single 'space' should be discarded in this case, since it's followed 
by a tab.

I don't know if the general rule can be something like:

"if (no. of spaces < tabWidthInSpaces) then discard spaces"

-or-

"if (no. of spaces < tabWidthInSpaces/2) then discard spaces else insert 
tabWidthInSpaces*space"


tabWidthInSpaces should default to 4...


Hope this helps...

-H-



More information about the Users mailing list