What you’re seeing is the result of software being more typographically conscious and replacing the incorrect characters we got used to typing in our keyboards with the correct ones. Same reason why " is replaced with “ and ”.
But you’re right that is annoying in a programming environment.
Heh, I kinda don't like these typing replacements (also, "smart" quotes).
If I type `--` it's because I want `--` (or even `-------` but some software† insists on changing that to a sequence of en-dash), especially I can type them easily on macOS:
- minus key: minus char -
- Option+minus: en dash –
- Option+Shift+minus: em dash —
Similarly, opening and closing single and double quotes are on bracket keys.
† yes there are OS-level settings for that (at least on macOS) but other software do it in addition to the SO, and you can't disable it plus it plays badly with undo.
Indeed “smart” quotes are a nuisance and it’s a small tragedy that curved quotes go typically unused. I gave myself a dedicated `“` key to make it the default in everyday use.
The em dash doesn’t exist to be aesthetically pleasing, it has a meaning in writing.
https://en.wikipedia.org/wiki/Dash#Em_dash
What you’re seeing is the result of software being more typographically conscious and replacing the incorrect characters we got used to typing in our keyboards with the correct ones. Same reason why " is replaced with “ and ”.
But you’re right that is annoying in a programming environment.