readline: Improve Unicode handling
Fixes: https://github.com/nodejs/node/issues/25693
- Makes delete and backspace work upon unicode code points instead of UTF-16 code units.
- Prevents moving left or right from placing the cursor in between code units comprising a code point.
In plain english: Deleting and moving the cursor across emoji works now, but grapheme clusters/characters like 👨👩👧👦
still have trailing blank spaces.
Ideally grapheme clusters would be used instead of code points, but until the proposal-intl-segmenter lands node seems to be without built in support for handling them.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines