Hacker News new | ask | show | jobs
by runarberg 2547 days ago
You right. Diff tools should use fixed width characters as diff operators (em-space, minus-sign, and plus sign are usually the same width in most fonts), but I doubt any diff tool does. It is a shame. The only reason we use monospace fonts as an industry is because that is how we’ve always done it, and now we are stuck there because we fail to think out side of the box (pun intended) when we make our tools.
2 comments

Monospaced fonts are good for editing. Variable width characters are good for quick reading because they allow you to scan past spelling errors in prose. Monospaced fonts have distinctive 'textures' that make them amenable to detecting symbol identity. Variable width fonts intentionally eliminate that texture and are often optimized for ink density to 'grey out' blocks of text. Arrow keys don't work predictably in variable width text.
There is no reason font designers can’t create variable width font faces that optimize character distinctions and important features while reading code. Many font faces even have settings that allow you to opt into making characters more distinguishable.

You are right about navigating between lines in a variable width fonts. However that is a problem with many text boxes on the web (including slack and github) and I don’t find it that much of a headache. I find it kind of rare that I need to navigate between subsequent lines and maintain the column except maybe at the start of the indentation level.

Not just diff tools. When you write your own code you are constantly diffing against other code. In essence monospace font prevents these kind of small errors.