A proposal to replace 'tab-size' with 'tabstop-widths'

Hi all.

I'm the inventor of elastic tabstops
(http://nickgravgaard.com/elastictabstops/), and I was recently
contacted by someone who was working on Ace (http://ace.ajax.org/),
which seems to be the most widely used browser based text editor. There
had been some demand for elastic tabstops and he was attempting to
implement it. This led me to look into how elastic tabstops might be
implemented in Ace. The first thing I came across was the 'tab-size'
property and I quickly realised that it was not sufficient to support
what was needed.

I would like to suggest something which is more powerful than 'tab-size'
(http://www.w3.org/TR/css3-text/#tab-size) but should be easily
implementable and would work like ''tab-size' when given one value. I
propose a new attribute called 'tabstop-widths' which takes a list of
widths measured in em and/or px values.

The default would be '8em' which in a monospaced font is as wide as 8
spaces or 'm' characters - the original Unix default and the same as the
'tab-size' default of '8'. It would however be possible to specify
values for the new 'tabstop-widths' attribute like '8em 70px 4em 30px'
which would mean the first tabstop should be positioned at a distance of
8 'm's (in the current font) from the left, then at an additional 70
pixels, then a further 4 'm' character widths, and then a further 30
pixels. The last value would be repeated which would mean in the example
I gave the value of '30px' would be repeated for the length of the
element. This would also mean that the default 'tabstop-widths: 8em'
would be the same as the old default 'tab-size: 8'.

Does that make sense? What do you think?

Nick
PS. It's not important but I call it 'tabstop-widths' rather than
'tab-stop-widths' because I think of a tabstop as being a thing or a
noun which is different to a tab.

Received on Saturday, 22 December 2012 22:44:26 UTC