3 ms·
Sublime-text-style multiple cursor text manipulation would break here. And your code would look different than everyone else's machine. How would you display a
by mattnewton 9y ago
Sublime-text-style multiple cursor text manipulation would break here. And your code would look different than everyone else's machine. How would you display a guideline to make sure you were under a characters-per-line style?
What advantages are there? I could never see it working for me. I want a program to format my code with resonable defaults and be done with it.
- tobr 9y agoHow would multiple cursors be affected by this? I use a proportional typeface and multiple cursors for all sorts of things, I can't really see how these concepts are even related. As you say, use automatic formatting and you don't need to worry about line-length. (Otoh, having a mandatory max line length makes about as much sense as having a max identifier length or a max lines per file.)
- bastijn 9y agoMax column length (line length) does make sense in one case. It simplifies side-by-side comparison. We have a max 100 column rule which is perfect for our merge and review tooling :). It was raised from 80 few years back and probably raises again to 120 as everybody has all their monitors 1920x1080 now. The idea is everybody should see the entire line in one go without wrapping enabled. A second reason is that it prevents nesting as a side effect. You are forced to make methods and don't go into nested if/for. Much easier to check for our (custom) linter than verifying for/if nested loop depth. Oh, Turning on word wrap is evil...
- mattnewton 9y agoYou can't drag a cursor down vertically and know what will happen, something I do surprisingly often because it is very powerful. Line length guide lines makes sense for me as a visual indicator of what will wrap when I hit the max lines per file. They are also nice ways to gauge when you are nesting too deep or making overly complicated expressions. Max line length allows you to do nice things with window management and diff tool layout and not spend forever moving around to see the text. I am a convert after thinking it didn't matter. Now it being 80 characters is arbitrary but so would almost any other number be.
- ghusbands 9y agoTypically, when you do column selection, the lines are identical to the left of the cursor or you're selecting the end of the lines, which both still work in a proportional font.
- Stratoscope 9y ago> your code would look different than everyone else's machine. Not if you use an indentation-only style like my second example. One of the great things about that style is that it looks the same on anyone's machine, whatever kind of font you use. If you read some of my code, you'll never know that I wrote it in a proportional font. It looks the same if you view it in a monospaced font. > How would you display a guideline to make sure you were under a characters-per-line style? Most programmer's editors have more than one way to do that. There is usually a column number in the status line, and some editors can be configured to change the background color on any part of a line that exceeds your required line length. That works with any font, and it's visually less obtrusive than a red vertical line partway across your editor window. Also, an indentation-only style naturally leads to much shorter line lengths. If you compare my two examples above, the column-aligned version extends to column 77, while the indented version only goes to column 40! That's barely half the line length for the same code. In practice, I think a lot less about line length since I switched to the indentation-only style, since my lines of code tend to be so much shorter as a result. And I tend to write the simplest functions I can without excessive nesting, so it's pretty rare that I come close to any worries about line length. > What advantages are there? For a proportional font, I simply find it easier to read and nicer looking. And as I mentioned, it also helped teach me to use indentation instead of column alignment. I'm not saying you or anyone should necessarily convert the the Proportional Church, only that it is a worthwhile exercise to try it for a while.
- kbd 9y agoWhat proportional font do you use? I'd like to give coding in a proportional font a try but would like something designed for programming instead of just experimenting with Verdana.
- Stratoscope 9y agoYeah, Verdana is not great. I used to use Georgia, but when I started doing more on OSX I found that it didn't render well in all apps - the character strokes were too skinny. It looked great in Windows though. For the last couple of years have been using Trebuchet MS. It's not designed specifically for programming, but it has many of the attributes of a good coding font, in particular all of the easily confused characters like 0Oo and 1Il are easily distinguished. The one thing I don't like about Trebuchet is that it has a really terrible tilde (~). Sometime I will sit down with a font editor and swap in a better tilde. I tend to use largish fonts on a high-DPI display, and Trebuchet really looks nice with that setup, both on Windows and macOS. Someone else recommended Input, which is designed for programming and comes in both proportional and monospaced variants. When I tried Input it didn't look as nice as Trebuchet MS to my eyes though. That will give you a few to try out!