Elastic tabstops

Thomas Orgis thomas-forum at orgis.org
Tue Jul 4 12:16:46 CEST 2006


Am Tue, 4 Jul 2006 09:58:56 +0200
schrieb Yann <cactux at gmail.com>: 

> With this idea of elastic tabs, the editor spots groups of lines with
> the same kind of tabs, then align the text across these lines on
> columns.

I thought tabs _are_ alignment characters that one puts in the file and
then, on _display_ a width is chosen.

But I think I slowly get the idea, when going away from indendation...

Looking at the example on the page (not the java program since my java
is too old...), I suspect that the real deal is not about indendation
but on general formatting and alignment... I see...
Hm, one should test the example implementation... I now guess the main
feature is some auto magic to align tabs on consecutive lines to each
other, so that the longest line causes the matching tabs on the lines
around it to be at the same position.
This actually sounds neat and is a sure bet on furious hate by every
coder that has to work with you and insists on using an editor without
these elastic tabs;-)
But it really could save many wasted bytes ans coder time on code that
extensively uses spaces to line up stuff like

{ 0,   "remote-err",  GLO_INT,            0, &param.remote_err,  TRUE },
{ 'd', "doublespeed", GLO_ARG | GLO_LONG, 0, &param.doublespeed, 0    },
{ 'h', "halfspeed",   GLO_ARG | GLO_LONG, 0, &param.halfspeed,   0    },
{ 'p', "proxy",       GLO_ARG | GLO_CHAR, 0, &proxyurl,          0    },
{ '@', "list",        GLO_ARG | GLO_CHAR, 0, &listname,          0    },

I never thought about doing such alignments with tabs since they don't
have a defined width. For me it always was

tab   = some undefined amount of indendation
space = exactly one char width for fixed-width font

And when I want char-exact alignment, I use spaces. The benefit from
elastic tabs here would mainly be saving time in chaning these alignments
when a one line is changed. Inserting/deleting these spaces manually
is a pain (and thus I rarely do extreme aligments like the above example).

If we want this in nedit, we should be careful about the needed computing
time. It should be no prob if we adopted the scheme that mcedit has for
syntax highlighting effects on multiple lines: Realigning of the
surrounding tabs only after changing a line and when leaving it (enter,
cursor) - doing this parsing and aligning on every character typed
may work for most people with fast machines, but I still like to edit
plain text on my old laptop.


Thomas.


More information about the Discuss mailing list