Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default tab width should be smaller #22

Open
daanx opened this issue Sep 25, 2017 · 3 comments
Open

Default tab width should be smaller #22

daanx opened this issue Sep 25, 2017 · 3 comments

Comments

@daanx
Copy link

daanx commented Sep 25, 2017

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

@lillem4n
Copy link

lillem4n commented Sep 26, 2017

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.

@ghost
Copy link

ghost commented Mar 4, 2018

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");
}

@hax
Copy link
Owner

hax commented Mar 7, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants