Elastic tabstops
Thomas Orgis
thomas-forum at orgis.org
Sat Jul 15 10:56:22 CEST 2006
Am Fri, 14 Jul 2006 05:01:48 -0400
schrieb Tony Balinski <ajbj at free.fr>:
> I've had to deal too many times with files modified by people whose
tab
> settings are different. In the past I have worked with width-8 tabs
(which
I'd really like to get this terminology straight: a width-8 tab means an
actual tab character and your editor displaying it as 8 spaces? Or you
typing tab and getting 8 spaces in file?
I'm getting confused by such terms because for me a tab doesn't carry
any width property with it.
The problems seems to be that other people than me think of it having a
certain width and use it for "fancy formatting".
> printers tend to agree on). I dropped using tabs when I started using
> Microsoft VC++, with its default setting of 4 (a more sensible width
for
> indents IMO) and came across the disaster of mixed width indentation.
I
Well, mixed width indendation with tabs cannot happen when you write
literal tab characters to the file... a tab is a tab.
The indendation of the whole file with depend on the tab display width
setting but it will be homogeneous regardless of your tab setting - be
it 2, 3, 4 or 8.
[...]
> equivalent. Inevitably there are places where people have indented
using
> spaces where the rest of the file uses tabs, or vice-versa. That's why
I
> added the backlighting functionality to NEdit: to be able to
distinguish tabs
> from spaces in a way that doesn't distract too much from the actual
text, and
Yes, backlighting is nice... although, without it I probably wouldn't
spend time correcting indendations that just look too ugly with mixed
tabs and spaces;-)
> to highlight control characters, which nedit displays otherwise as
simple
> mnemonics. I always have backlighting turned on.
>
> (BTW I tend to prefer an indent of 2, and lines that fit 80 columns.
When
I use displayed tab width of 2, too. I didn't like tab indendation in
the past because it used so much space (and made 80char lines impossible
at some level;-) - until I learned that you can set the displayed width
of a tab in your editor.
Then I really started liking them because now I could code together with
other people who prefer 4-space indent. We all simply type tabs, but
have different displayed width of tabs.
> you have such a narrow indent, pressing tab or space doesn't make much
> difference. I use an emulated tab distance of 4, and physical tab
distance of
> 8.
Please help me understand this. When you type a tab you get 4 spaces and
an actual tab is displayed as 8?
> If I'm given a file to maintain I will respect its overall tab usage,
often
> correcting inconsistent space/tab usage, but left to my own devices I
have a
> strict no tabs policy.)
Well, respect your elders;-) If left to my own devices, I have a strict
tab-indent / spaces for fancy formatting (if I really bother to do it)
policy.
>
> Check out the links from the Wikipedia page
http://en.wikipedia.org/wiki/Tab -
> it's entertaining at least!
Hm, I should still add an "any key" to my keyboard.
>
> > "Fancy" layout is a different matter, but I really like the ability
to
> > decide the indent width on display and have the number of tabs ==
number of
> > levels of indendation.
>
> I see why the proposed fix appeals to you then. It is impossible to
manage
> alignment using standard tabbing if you want to allow the tab width to
change.
I use tabs for indendation without that proposed feature - with the full
intention for the tab width to be changeable.
if(something)
{
code
}
(4 spaces) is not really different from
if(something)
{
code
}
(2 spaces) but it may appeal more to a programmer's taste.
OK, you said alignment - probably meaning something like
array = { 1, 45, 2,
56, 4, 23 };
I wouldn't try to do that with tabs. So maybe we agree here.
Looking at the wikipedia, the initial meaning of tab really suggests
these elastic tabs, though. Only with a feature like that I would think
of using tabs for tricky alignments.
> The trouble is that not all tools understand tabs in this way. Much
as I tend
> to (over)use nedit for everything, I can't live without other tools...
But in my view, every tool displays at least tabs that start a line with
some fixed width in a consistent manner.
Could we perhaps agree on usage of tabs solely for indendation
(whitespace before any code in a line) not being the bad thing?
Greets,
Thomas.
PS: When I talk to friends about this issue, there are some who are
really quite ignorant to all of this since they run a code beautifier /
automatic formatter over their stuff to get the style right and don't
bother while writing:-/
More information about the Discuss
mailing list