5 ms·
I gave up on proportional fonts after a while. That was about 15 years ago, though... I think using clang-format and Comment Reflower/Emacs M-q/etc. would solve
by to3m 9y ago
I gave up on proportional fonts after a while. That was about 15 years ago, though... I think using clang-format and Comment Reflower/Emacs M-q/etc. would solve most of the problems I had with creating code that looked sensible when other people looked at it. If you've got the whole team layout out their code using tools like that, then the proportional font people won't find themselves having to line things up and whatnot.
Still doesn't solve the issue of having ASCII art diagrams in your comments. Though... the comment word wrap plugin I use for Visual Studio has markup to say that it should leave a section of the comment alone (I use this for ASCII art bits). And clang-format has similar directives for blocks of code that it should leave alone. Would be nice if text editors could recognise these (and other similar markup - or perhaps markup could even be standardized between tools?) and render the appropriate sections in a monospaced font. That might be a useful compromise.
- repsilat 9y agoI wonder if you could approximate the readability of proportional fonts with kerning rules -- let some letters steal or donate width, so it's not perfectly monospaced within any word, but word boundaries still line up.
- Stratoscope 9y agoCould you share the name of that comment word wrap extension? I use proportional fonts for all my code editing, but I would like a way to be able to switch a block of code within a file to monospaced - like you mentioned for ASCII art, or for matrices (the one place where I still would use column alignment). This doesn't sound exactly like what that extension does, but it might be something good to look at to get some ideas. (Hopefully it's open source!) Thanks!
- to3m 9y agoNo, it doesn't do anything like that - it just does word wrap. Comment Reflower: https://marketplace.visualstudio.com/items?itemName=codebeast.CommentReflower https://marketplace.visualstudio.com/items?itemName=codebeas... (page says it works up to VS2015, but I've got it in VS2017 too - so presumably it's forwards-compatible?) One of its features is that you can pop comments sections in a <pre>...</pre> block to stop Comment Reflower doing anything to them. Here's an example, where you can see that the preformatted section extends past the wrap column. // Watford DDFS reads by initiating a multi-sector read, // counting sectors read, then doing this when it's got // the data it wants: // // <pre> // 0D43: ldy #$60 A=00 X=FF Y=60 S=DC P=nvdIzC (D=60) // 0D45: dey A=00 X=FF Y=5F S=DC P=nvdIzC (D=D0) // 0D46: bne $0D45 A=00 X=FF Y=5F S=DC P=nvdIzC (D=01) // 0D48: lda #$D0 A=D0 X=FF Y=00 S=DC P=NvdIzC (D=D0) // 0D4A: sta $FE84 A=D0 X=FF Y=00 S=DC P=NvdIzC (D=D0) // </pre> // // The loop at D43 is $5f*(2+3)+(2+2)=$1df=479 cycles, or // 240 usec. So if you had a text editor that implemented my idea, the first and last paragraph would be in proportional type, and the disassembly bit in the middle would be shown in monospaced to preserve the formatting. (In the long run, ideally, I suppose, you'd want your code text editor to support a wide range of formatting options, so that you could have italics and bold and monospaced and all sorts. But if you just decided that initially a simple proportional/monospaced font switch would be useful, this is the sort of markup you could use to key the transition off.)
- Stratoscope 9y agoGreat, thank you very much! Even if this doesn't do exactly what I'm looking for, it will definitely help give me some ideas on how to do what I want. It is indeed open source, and it looks like VS2017 support was added a few months ago: https://github.com/kmunson/CommentReflowerVSIX https://github.com/kmunson/CommentReflowerVSIX