[Geany] spaces, tabs and saving

Harold Aling h.aling at xxxxx
Wed Jun 6 21:20:13 UTC 2007


Amir R. Saffari A. A. wrote:
> Thanks a lot for making geany one of the best IDEs out there. I have 
> just a feature request which someone had already suggested, but still 
> not implemented yet. It's about replacing tabs with spaces: what geany 
> does is that during the editing the text, it inserts tabs, and when 
> you save the file it converts them to spaces. While this is what 
> replacing means, actually it sometimes messes up the text identation 
> and configuration. Let me give an example here: let's assume that I'm 
> writing the following text (with \t I mean presseing TAB key and we 
> have set the tab to be 2 spaces width):
>
> a\t\t= 1;
> b\t\t= 2;
> ab\t= 4;
>
> What we expect to see is that = signs are all aligned nicely, which is 
> what happens: a and b have 3 spaces in front while ab has 2.
>
> Now when you save this text, geany replaces all tabs with 2 spaces, 
> this makes the distance of a and b to the = sign as 4, while keeping 
> the number of spaces in front of ab equal to 2. As a result, you lose 
> the alignment you wished to have.
>
> I think the solution is to just take the modular of the number of the 
> where we press the TAB with the tab width and insert that amount of 
> space instead of a fixed amount of it. I'm not familiar at all with 
> geany's source, otherwise I would try to see how I can solve it.
>
> Best Regards
> Amir
Sort of off-topic:

I've recently loaded a large Python project called Sonata in Geany and 
upon save, the indentation of ~30 lines got screwed up. Python doesn't 
like that...

I had to manually check and correct all lines in a ~7000 lines file...

So, I can confirm that replacing tabs with spaces is a bit 'buggy' at 
least...


Cheers!

-H-



More information about the Users mailing list