trix icon indicating copy to clipboard operation
trix copied to clipboard

fix: prevent surrogate pairs from being split by the selected range

Open Thomaash opened this issue 11 months ago • 3 comments

This is already handled in functions like expandSelectionInDirection which won't select a half of emoji etc. but always the whole surrogate pair. The solution here is the same, if the cursor is placed in the middle of a surrogate pair, it will be moved to the end of the pair. Similarly a selection will either select both or neither.

Thomaash avatar Feb 17 '25 14:02 Thomaash

Hi @jorgemanrubia, could I ask for a code review?

Thomaash avatar Mar 25 '25 15:03 Thomaash

Hi @jorgemanrubia or @flavorjones, is there any chance for this to be reviewed and merged/rejected?

Thomaash avatar Oct 14 '25 14:10 Thomaash

I've rebased this onto current main and verified that the tests pass locally. Code seems find to me. But I'm not sure I understand the problem that's being solved.

@Thomaash can you say a bit more about how this problem occurs in an application -- how is the cursor ending up in the middle of a multi-byte code point?

flavorjones avatar Oct 23 '25 19:10 flavorjones