4 ms·
In the example in that stream of tweets, you have: put = blah get = blah post = blah patch = blah gofmt accepts it as aligned, but the eq
by hyperpape 9y ago
In the example in that stream of tweets, you have:
put = blah
get = blah
post = blah
patch = blah
gofmt accepts it as aligned, but the equals signs are visually unaligned when using a proportional font.
I wonder what it would take to create an editing environment where you have a proportional font that shrinks or grows the (visual) whitespace to align those, and whether it could scale to things like nested functions.
- e12e 9y agoSurely, one logical space of variable width is a tab? I prefer spaces to tabs - but if one makes concessions to readability like variable-width fonts - it's time to bring back tabs, too? (I do think this is a good idea, but "before" spaces won, in no small part because pre high-resolution screens, I think monospace was the better choice. With high dpi comes pretty layout - also of code).
- teddyh 9y agoThe solution: Elastic Tabstops (http://nickgravgaard.com/elastic-tabstops/ http://nickgravgaard.com/elastic-tabstops/)
- ActsJuvenile 9y agoThis is awesome - thank you!
- Stratoscope 9y agoFor me the low DPI vs. high DPI displays didn't make a difference. I've been using proportional fonts ever since the days of very low DPI displays and still like them now that I only use high DPI displays. The key to using proportional fonts is to stop using column alignment and use only indentation instead. There's an illustration of this in the rustfmt code I posted elsewhere in this thread. And you're right, once you abandon column alignment, there's no longer any reason to prefer spaces over tabs, so you can take advantage of the other benefits of tabs.
- pugworthy 9y agoThe catch is, if I try to work with code relying on special stuff, and I don't have your special font, or special extension, etc. your code will look terrible. Consider for any of these ideas (and the idea of various fonts) just how well it would work for the masses. Consider the mess if someone works on an open source project and checks in a bunch of code formatted for this. Which is why I guess I'd see any kind of "fancy" spacing or even proportional fonts to be a real problem in an organization or structure where potentially many people, or new people over time, will have to work with the code.
- Stratoscope 9y agoWhat is really strange about this is that Rob Pike prefers proportional fonts, but gofmt mandates a column-aligned format that only works well with monospaced fonts. This is one reason I don't use Go today. I am never going back to a column-aligned format that is hard to read in a proportional font, so I would have to avoid the use of gofmt, which would make me an outcast in the Go community.