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

Use spaces instead of tabs for spacing #243

Closed
nodiscc opened this issue Mar 14, 2017 · 5 comments
Closed

Use spaces instead of tabs for spacing #243

nodiscc opened this issue Mar 14, 2017 · 5 comments

Comments

@nodiscc
Copy link
Contributor

nodiscc commented Mar 14, 2017

user.js and associated documentation currently uses tabs for element spacing and alignment. As tabs have different widths depending on the environment, this leads to different indentation for different users and contributors, and unneeded/not-working alignment work (eg 402268a). Attached screenshots of random user.js and documentation sections in 2 editors I frequently use (mousepad and nano):

cas-indent
userjs-indent

The tabs-vs-spaces question has been largely debated all over the Internet, but the most commonly accepted convention is that:

  • tabs are for tabulation
  • spaces are for spacing/indentation

https://softwareengineering.stackexchange.com/questions/57/tabs-versus-spaces-what-is-the-proper-indentation-character-for-everything-in-e/66#66

We should apply this convention and use spaces to align elements.

@pyllyukko
Copy link
Owner

For me, the terminal is the reference on how it should look. This was what I was after:

tabs

And since Vim agrees, this has been the easiest and most logical way to do the alignment for me. I'm sure there will be at least as much re-alignment commits even if we would move to spaces.

The README is another story, that could use spaces for the tables as they actually work better when editing them.

@nodiscc
Copy link
Contributor Author

nodiscc commented Mar 19, 2017

The second screenshot is from my terminal (nano editor in xfce4-terminal), so tabs width is apparently different between terminal emulators too (idk which one you use).

I'm sure there will be at least as much re-alignment commits even if we would move to spaces.

Nope, since our terminal emulators use monospace fonts (all characters have the same width).

Edit: for science I just changed my terminal font to Comic Sans MS and it looks like xfce4-terminal even forces non-monospace fonts to monospace. Made my eyes bleed so I reverted to Hack.

@pyllyukko
Copy link
Owner

The second screenshot is from my terminal (nano editor in xfce4-terminal).

This is what the same combo looks for me (xfce4-terminal 0.6.3 & nano, version 2.6.0):

nano

@nodiscc
Copy link
Contributor Author

nodiscc commented Mar 19, 2017

This is what the same combo looks for me
Looks different on my machine

That's what tabs do. Look different depending on your editor, your terminal, your font, the weather... Spaces don't suffer this problem.

Anyway I agree it's a minor problem. xfce4-terminal 0.8.3-1 and nano 2.7.4-1 here by the way (Debian stretch).

@pyllyukko
Copy link
Owner

I'm sure there will be at least as much re-alignment commits even if we would move to spaces.

Nope, since our terminal emulators use monospace fonts (all characters have the same width).

What I meant with this, is that it's even easier to get off-by-ones etc. and we would still need to re-adjust 'em from time to time.

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

2 participants