Hacker News new | ask | show | jobs
by knolax 2232 days ago
Personally I find double click highlighting to be a useless feature in any language, but the Firefox approach is superior imo. Breaking at script boundaries is predictable behavior the user can anticipate whereas doing some janky ad hoc natural language processing invariably results in behavior that is essentially random from a user perspective. I tried out double click highlighting on some basic Japanese sentences on Chromium and it failed to highlight any of what would be considered words.

It's not like English highlighting does complex grammatical analysis to make sure "Project Manager" gets highlighted as one chunk and "eventUpdate" gets highlighted as two chunks, most implementations just breaks at spaces like the user expects.

4 comments

I use double-click highlighting, and the reason is mostly selecting passages of text when editing. Double-click highlighting makes it so I don't have to find the precise character boundaries for the first and last words in the passage. Instead, I can just double click the first word, roughly move my mouse to hover over the last, and copy or delete that entire passage.

Firefox's approach is fairly useless in this regard. Even if it's predictable from a technical perspective, it's not predictable for a reader who naturally processes semantic breaks rather than technical ones. Unlike in English, where a space is both semantic and visual, hiragana-kanji boundaries often don't mean anything. As a result, for me at least, Firefox's breaks feel a lot more random than Chrome's, which, while dodgy, are often fine.

Having used Firefox as my main browser since 2006, I remember when I discovered this feature in Chrome, and being shocked at how much of an effect that minor improvement had for me. It's not a deal-breaker, certainly, but it's become my one big annoyance with Firefox.

I'm Japanese and I agree that Firefox behavior makes sense. For example, a text with kanji like "その機能拡張は、", A word "機能拡張" consists of "機能" + "拡張" words. In Chrome, double-click makes individual part (like 機能) selected which is rarely wanted behavior for me. In Firefox, the whole word (機能拡張) is selected, which is wanted mostly.
It's pretty painless to select the next word though. It's best for the computer to err on the side of caution in this case.

[Edit: Ah, it might not be common knowledge but you can drag on the double click to select more words. You can also hold alt while editing text to jump words, and even combine alt+shift and alt+delete. Windows and Apple differ on the boundaries wrt whitespace, but I'm fairly sure they're both alt. Wordjumps while editing is an unappreciated superpower imo.]

Also FWIW Safari also supports this.

https://files.catbox.moe/c3bzva.mov

I know drag after double click action but I don't use double click to select action for Japanese text and always select text by dragging because I prefer predictable operation.

I don't know Alt + Shift/Delete action, how is it useful?

Word-jumping behaviour with the arrow keys on Windows uses Ctrl, not Alt. Holding Shift selects individual characters, while Ctrl+Shift selects words.
I think all of this just highlights (hah) that the way we think of human-language strings needs to change. They're not a stream of characters, they're their own thing with complex semantic rules. They should be represented as an opaque blob only manipulated via an API or passed to an OS for rendering etc.

Machine-readable strings can still just be an ASCII byte array, but we need to keep the two separate.

I feel like this is a conclusion you could only reach by having an irrational compulsion to defend the deficiencies of Firefox, and not being a regular user of the Japanese language.
I don't even use Firefox. You know what's really irrational? Trying to find ulterior motive in an argument instead of addressing its substance.
I don't use/speak Japanese, but the GP's conclusion makes complete sense to me.

Consistent behavior > inconsistent behavior, almost always. If I can anticipate what my computer is going to do, I can plan around it, even if it means a bit of extra manual work.

That doesn't work if the consistent behaviour is completely useless. If double click selected English tokens grouped by which half of the alphabet they came from, nobody would ever double click anything, they'd just click-drag highlight.
Are spaces completely meaningless in Japanese? I was under the impression they separated phrases.
Spaces have zero importance to the Japanese language itself, but they are occasionally used like punctuation. e.g. some YouTube video titles will use spaces around names of things that could be hard to parse as not part of a sentence, another example is when you're typesetting phrases in lyrics.

In general, whitespace characters have no place or significance inside a Japanese sentence, and most of the whitespace in Japanese typesetting is built into punctuation marks.

Furthermore, even most punctuation is optional in Japanese. The full stop 。 and comma 、 are mostly a matter of preference, sometimes spaces are used in place of full stops or commas.