5 ms·
>One other neat thing about _ is it will reliably select the whole token when you double click on it Shout out and kudos to whomever brought that up
by vsareto 6y ago
>One other neat thing about _ is it will reliably select the whole token when you double click on it
Shout out and kudos to whomever brought that up
- chatmasta 6y agoFrankly the fact that this doesn't happen with `-` in a `<code>` block should be considered a browser bug.
- williamdclt 6y agoWell it doesn't happen in IDEs either (by default, at least)
- chatmasta 6y agoI can see the argument for multi-line pre-formatted code blocks, but for inline `<code>` it would be nice if double clicking anywhere selected the whole thing.
- williamdclt 6y agoI'd rather consistent behaviour TBH, I'm not too happy that `-` is a non-word character but I'd rather it always behaves the same everywhere without having to think about context
- rgoulter 6y agoI wasn't quite aware of this because there are slight inconsistencies in some programs and between OSs. e.g. in powershell on Windows, Ctrl+Backspace deletes the word part, but in cmd shell, Ctrl+Backspace deletes until whitespace. The keybindings to delete word also vary on Windows vs MacOS (Alt+Backspace deletes a word on mac, but deletes the whole line on Windows. Windows uses Ctrl+Backspace for that). I was also confused since by-default Emacs doesn't treat `_` as a word character.
- mbauman 6y agoIs it `a-long-identifier` or is it `x-y`?
- jakear 6y agoIdeally it’d use the language defined word separators. I fought for that in vscode but was out-voted :)
- atq2119 6y ago'-' is a minus sign. It will appear in code blocks much more often in contexts where you do want it to act as a word delimiter.
- chatmasta 6y agoTrue, good point. Although if there are no spaces around it, it’s probably not acting as an operator. But at that point any heuristics to determine what it’s doing are well beyond the scope of the browser highlighting feature.