Sat 25 Feb 2017 09:27:30 PM UTC, original submission:
(This is a similar problem to that of bug 48489, hence the similar title.)
In current git, Unicode input mode (Meta-V, plus a 6-digit hex sequence) reads in text properly, but, in parse_verbatim_kbinput(), adds the bytes to the buffer one by one after the sequence is complete. Those bytes are, of course, invalid UTF-8 individually, but create a valid sequence as a whole. However, their being added individually means that the character count increases by one for each byte, when it should only increase by one for each character.
You can reproduce one test case as follows:
1. In a UTF-8 locale, run "nano --ignore --const --nonewlines".
2. Type: Meta-V "0 0 2 6 3 8". This will add the Unicode character U+2638 to the empty buffer.
3. Note that the character count in the cursor position display now says you're on character 1 out of 3, when it should say 1 out of 1. This is because the UTF-8 sequence for character U+2638 is three bytes long.
|