atom-elastic-tabstops icon indicating copy to clipboard operation
atom-elastic-tabstops copied to clipboard

Default tab width should be smaller

Open daanx opened this issue 8 years ago • 3 comments

What a great package! I love editing with elastic tabstops.

I have a small suggestion, currently in elastic-tabstops.js, (line 254), it says:

tab.style.width = '1ch'

which I suggest changing to:

tab.style.width = '0.33ex'

This looks much better. Any indentation tabs still have the default tab-width as specified by the user but any tabstops in text will now behave more like a single space character (especially when using proportional fonts). That way, we can allign code like parameter lists much nicer: using * for a tab, for example:

foo(*x : int,
    *y : int);

with a default of 1ch the spacing between the open parenthesis and the x parameter becomes too much; but with 0.33ex it looks much more natural. Or,

let *foobar *= 32
    *gnu    *= 42
in gnu + foobar

where the spacing from the identifier to the equals sign is more natural. Perhaps we should make it even into a user modifiable setting since the exact value may depend a bit on the particular font that is used. (0.33ex looks quite fine though on most fonts I tried -- usually I use the proportional Zilla Slab)

Best, Daan

daanx avatar Sep 25 '17 17:09 daanx

Perhaps we should make it even into a user modifiable setting

+1 to that!

Me myself very much prefer the 1ch width in-text indentions. It makes it possible to add more space with a simple setting if the content is very cluttered.

lillem4n avatar Sep 26 '17 20:09 lillem4n

It’s interesting to note that the ch unit from CSS is supposed to mean the width of the digit zero, and not of the space character. This doesn’t matter with monospaced fonts, but with proportional fonts, the tab looks a little too big compared to spaces. Perhaps someone should suggest a “functional length unit” to the CSSWG that allows people to choose the character(s) of the unit:

span.foo-bar
{
    display: inline-block;
    min-width: 1ch(" ");
    max-width: 1ch("hello");
}

input.month
{
    width: 1ch("0000-00");
}

input.money
{
    width: 1ch("000.00");
}

zamfofex avatar Mar 04 '18 20:03 zamfofex

@Zambonifofex I think your suggestion is attractive. You should go to https://github.com/w3c/csswg-drafts/issues to submit it for css-values-4 draft.

hax avatar Mar 07 '18 06:03 hax