8 ms·
Yeah it made sense for old monitors and then a lot of people got into their minds that it was some kind of rule that could never be changed. The limits you sho
by IshKebab 3y ago
Yeah it made sense for old monitors and then a lot of people got into their minds that it was some kind of rule that could never be changed.
The limits you should observe today are more like:
* Code line length: ~120-140 characters. Longer than that and it gets unwieldy especially in side-by-side views. But you don't need to be strict about it. It doesn't matter if the occasional line overflows. The best code formatting algorithm I know (the Prettier algorithm) doesn't have a strict limit.
* Commit subject length: 72, because Github will overflow anything longer into an ellipsis.
* Commit body line lines: No limit (unless you are developing the Linux kernel). I don't know of an interface other than email that doesn't wrap them.
(You're going to get a lot of old farts disagreeing with this advice, but don't listen to them.)
- _ZeD_ 3y ago>>> (You're going to get a lot of old farts disagreeing with this advice, but don't listen to them.) "I used to be with 'it', but then they changed what 'it' was. Now what I'm with isn't 'it' anymore and what's 'it' seems weird and scary. It'll happen to you!" seriously, it's not "being old farts", it's being reasonable with your eyes and your tools: while you may have 20/20 eyes, you will agree with me that viewing a diff of two columns of code at 10px fonts is not an happy thing to do, as the difference may be just a comma or a dot, and those on a 15" 4k monitor are about 0.3mm. And you cannot really view the whole columns without scrollbars or overflows if you set the font much bigger.
- matklad 3y ago>I don't know of an interface other than email that doesn't wrap them. Here are some common examples: 1. GitHub's single commit view word-wraps at monitor width, not at a reasonable line length: https://github.com/matklad/repros/commit/9351f5c91bd1d80dbcc37719d6ddd0f306b9c780 https://github.com/matklad/repros/commit/9351f5c91bd1d80dbcc... The result is completely unreadable. 2. `git log` in a full-screen terminal wraps at window width, not at a readable length. 3. In VS Code in Magit, lines are not wrapped at all by default. It is possible to enable wrapping, but then they are wrapped at the screen edge, not at a readable line length. I _think_ VS Code actually has a setting to visually wrap at column, but I wasn't able to make that work. Additionally, if you look at that commit message, you'll see that, to properly soft-wrap it, you'll need a markdown parser to recognize an indented bullet list. VS Code actually wraps that list correctly, but I expect very few other tools to do that.
- matklad 3y agoFor comparison, this is how the message looks when wrapped manually: https://github.com/matklad/repros/commit/7d7dc3e3539e8cc68e542298132eb917b1d7ccf8 https://github.com/matklad/repros/commit/7d7dc3e3539e8cc68e5... (Every time I see someone advocating for _not_ wrapping plain text formats, I can't get an image of a hammerhead shark sitting in front of a 16:9 display out of my mind :-)
- IshKebab 3y agoYeah that's definitely not idea, but neither is manually wrapping. Look what happens when your manual wrapping gets wrapped again! https://i.postimg.cc/x1KFkyMZ/image.png https://i.postimg.cc/x1KFkyMZ/image.png I think I'd take stupidly long lines over that tbh.