Repository navigation
Repository list table is misaligned when rendering emojis #9018
Description
Activity
- addedgh-reporelating to the gh repo commandrelating to the gh repo commandpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
on Apr 29, 2024 Taking a bet here I bet we're doing something like counting bytes or runes and the emoji is being counted as > 1 space.
@williammartin Yeah, I believe the
DisplayWidthis not accounting for multiwidth runes correctly, made a PR ingo-ghto fix that:Just so we're all on the same page (including future me when I inevitably rediscover this in the future), what we're addressing here are characters than have multiple runes. Go stores strings as runes which I believe are 2 bytes in UTF-8. Some unicode characters like grapheme clusters can take more than 2 bytes, which means counting by rune is not sufficient: https://ardislu.dev/biggest-unicode-grapheme-cluster
This has been marked closed by the GitHub magic but we actually need to release
go-ghand bump it here, so I'm reopening it.Reacted by Maas Lalani and Melissa XieThis is also a good write up about Grapheme Clustering: https://mitchellh.com/writing/grapheme-clusters-in-terminals
👋 Now that
go-ghhas been released and it's been bumped up ingh2.49.0 today, can we consider this fixed?Reacted by Maas Lalani
Describe the bug
gh repo listtable is misaligned when rendering emojis.> gh --version gh version 2.48.0 (1980-01-01) https://github.com/cli/cli/releases/tag/v2.48.0Steps to reproduce the behavior
Expected vs actual behaviour
Column should be aligned, regardless of emojis.