Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's quite difficult to handle double width characters and emojis reliably on all modern terminal emulators

First, the application and terminal must agree which Unicode characters are double width, as in take up two cells and move the cursor by two positions. Terminals vary at this.

Second, many emojis aren't single Unicode characters. Those are each a single emoji generated from certain sequences of combining characters with a base character. The application and terminal have to agree which sequences combine in this way, as well as how wide to display the resulting emoji. Terminals vary at both of these. Example: https://github.com/alacritty/alacritty/issues/3975

Third, IIRC some terminals treat emojis as moving the cursor by two positions because they use an approximately square space, some terminal do not and the emoji overlaps the next character.

Fourth the terminal might not be in UTF-8 mode so will treat the characters differently if it isn't.




I agree it's difficult to handle, it's difficult to handle because a terminal assumes one character == one cell. but to me the difficulty would seem to come from getting the cursor to select the entire letter rather than the individual cell.

Which is why I'm confused about the model they're using.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: