Use UAX#29 word boundary rules for selections by default #18902

Closed
opened 2026-01-31 06:27:43 +00:00 by claunia · 6 comments
Owner

Originally created by @lhecker on GitHub (Nov 15, 2022).

Description of the new feature/enhancement

Source: https://github.com/microsoft/terminal/issues/14374#issuecomment-1315297524

[...] I think I just now realized how "crazy" those ASCII word delimiters are in an international setting. For instance this:

ねこはかわいい。

It consists of 3 words and a delimiter (ねこ , は , かわいい , 。) and your browser probably handles this correctly, whereas terminals are perpetually stuck in the "What do you mean there are people who don't speak English?". conhost's whitespace-only splitting doesn't feel any better in that regard. I feel like terminals are in a dire need of some UAX #29, Section 4.

Proposed technical implementation details (optional)

Originally created by @lhecker on GitHub (Nov 15, 2022). # Description of the new feature/enhancement Source: https://github.com/microsoft/terminal/issues/14374#issuecomment-1315297524 > [...] I think I just now realized how "crazy" those ASCII word delimiters are in an international setting. For instance this: > > ねこはかわいい。 > > It consists of 3 words and a delimiter (ねこ , は , かわいい , 。) and your browser probably handles this correctly, whereas terminals are perpetually stuck in the "What do you mean there are people who don't speak English?". conhost's whitespace-only splitting doesn't feel any better in that regard. I feel like terminals are in a dire need of some [UAX #29, Section 4](https://unicode.org/reports/tr29/#Word_Boundaries). # Proposed technical implementation details (optional) * Use this by default: https://unicode.org/reports/tr29/#Word_Boundaries * Use character-set splitting, if the user has configured `wordDelimiters`
Author
Owner

@j4james commented on GitHub (Nov 15, 2022):

and your browser probably handles this correctly

For the record, my browser (Firefox) does not.

And while I agree that it's worthwhile considering a more international-friendly approach, we also need to bear in mind that command-line text selection is possibly somewhat different from typical document text selection, so sticking strictly to the UAX#29 spec may not be ideal as a default (assuming we're considering changing the default).

For example, in a terminal, the decision as to whether a punctuation character should be treated as a separator or not is often based on the semantics of that characters in the shell (e.g. slash as a path separator, or colon as a drive letter suffix). I haven't looked at the UAX#29 spec in detail, but I suspect it is unlikely to categorize punctuation symbols in the same way.

And in your example above, if those characters were used in a path, and you were trying to select that path, would you really want the selection to stop at the word boundaries? I don't know. That's really a question for the people that speak the language, and in what situations they're most likely to be double clicking on strings of Japanese characters. But my point is that it's not necessarily obvious that UAX#29 would be best default.

@j4james commented on GitHub (Nov 15, 2022): > and your browser probably handles this correctly For the record, my browser (Firefox) does not. And while I agree that it's worthwhile considering a more international-friendly approach, we also need to bear in mind that command-line text selection is possibly somewhat different from typical document text selection, so sticking strictly to the UAX#29 spec may not be ideal as a default (assuming we're considering changing the default). For example, in a terminal, the decision as to whether a punctuation character should be treated as a separator or not is often based on the semantics of that characters in the shell (e.g. slash as a path separator, or colon as a drive letter suffix). I haven't looked at the UAX#29 spec in detail, but I suspect it is unlikely to categorize punctuation symbols in the same way. And in your example above, if those characters were used in a path, and you were trying to select that path, would you really want the selection to stop at the word boundaries? I don't know. That's really a question for the people that speak the language, and in what situations they're most likely to be double clicking on strings of Japanese characters. But my point is that it's not necessarily obvious that UAX#29 would be best default.
Author
Owner

@zadjii-msft commented on GitHub (Nov 15, 2022):

#3077?

@zadjii-msft commented on GitHub (Nov 15, 2022): #3077?
Author
Owner

@DHowett commented on GitHub (Nov 15, 2022):

I agree broadly with James' assessment, but I will also provide a more "local" example: C:\Documents and Settings\Dustin Howett has "visible" word boundaries and poses an issue for selection as well.

Now, if we could somehow get (reliable, correct) semantic selection . . . that would be neat. And impossible.

@DHowett commented on GitHub (Nov 15, 2022): I agree broadly with James' assessment, but I will also provide a more "local" example: `C:\Documents and Settings\Dustin Howett` has "visible" word boundaries and poses an issue for selection as well. Now, if we could somehow get (reliable, correct) semantic selection . . . that would be neat. And impossible.
Author
Owner

@lhecker commented on GitHub (Nov 15, 2022):

Should we close this issue in favor of #3077 then? If we do that, I'd probably edit #3077 to include more specific references to UAX#29 in the title and description.

@lhecker commented on GitHub (Nov 15, 2022): Should we close this issue in favor of #3077 then? If we do that, I'd probably edit #3077 to include more specific references to UAX#29 in the title and description.
Author
Owner

@zadjii-msft commented on GitHub (Nov 15, 2022):

Moved a bunch of this to /dup #3077

@zadjii-msft commented on GitHub (Nov 15, 2022): Moved a bunch of this to /dup #3077
Author
Owner

@ghost commented on GitHub (Nov 15, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Nov 15, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18902