[TxMt] Re: Just starting to call myself a full time TM uses, general

Adam Strzelecki ono at pingu.ii.uj.edu.pl
Mon Jun 8 16:51:29 UTC 2009


Allan Odgaard wrote:
>  (...) I do think there would be
> too big a compatibility problem with actually
> saving such files, since all renderings of the file
> (cat it in terminal, paste it in an email, on the
> web, etc.) would be wrong — and it’s not easily
> fixable, e.g. by piping the text through something
> like expand, which would normally fix presenting a
> file with the wrong tab size.

Yeah, that's right. Moreover the proposed "elastic tabs" does describe  
the method only with this fancy picture, but does not provide exact  
algorithm or at least block schema how to implement it. So this sounds  
to me like an empty wish not a standard.

My personal approach to indenting is to use tabs where possible at the  
beginning of the line, but if there comes first character or chunk of  
code, I align everything at the right just with spaces, i.e.:

struct {
⇥int counter; /* Some counter */
⇥struct {
⇥⇥int x;
⇥⇥int y;
⇥} pos;       /* Position */
⇥char *text;  /* Inner text */
} CONTEXT;

if(font_name) {
⇥NSString *fontName = [[[NSString alloc] initWithUTF8String:  
font_name] autorelease];
⇥NSFont *font = [[NSFontManager sharedFontManager]
⇥⇥fontWithFamily: fontName
⇥⇥        traits: (bold ? NSBoldFontMask : NSUnboldFontMask) |  
(italic ? NSItalicFontMask : NSUnitalicFontMask)
⇥⇥        weight: 5.0f * font_weight / 100.0
⇥⇥          size: (float)font_size];
⇥NSMutableDictionary *attr = [NSMutableDictionary dictionary];
}

This approach guarantees that suff aligned at right or center will be  
more/less aligned well regardless of tab size.

Cheers,
-- 
Adam Strzelecki




More information about the textmate mailing list