contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 102 forks source link

wide emoji on trivial text lines to be inflated will become narrow emoji (bad cursor advancement) #1375

Open christianparpart opened 6 months ago

christianparpart commented 6 months ago

Refs #1215.

printf "A\u2764\uFE0F\u200D\U0001F525B\nA\u2764\uFE0FB\n"

This is properly printed to the terminal, but as soon as going into input normal mode and moving the cursor over/across the printed line, will make the emoji look narrow.

The bug most likely is in the inflation code, that is going to be rewritten in libunicode ASAP anyways. But we keep this ticket as a tracker to not forget about it.

image
Yaraslaut commented 6 months ago

Also, this:

https://github.com/contour-terminal/contour/issues/1215#issuecomment-1865074121

Yaraslaut commented 2 months ago

Behavior changed after https://github.com/contour-terminal/contour/pull/1501 PR but bug is still present

Yaraslaut commented 2 months ago

Bug is happening during the inflation of the line, emoji use double width and therefore can not be split into two independent cells, and we end up in corrupted state when part of the emoji is inside one cell, and another part is in another cell with the next character, so for this case after inflation we have 1 -> A 2 -> half of the emoji 3 -> half of the emoji + B