Skip to content

Repository list table is misaligned when rendering emojis #9018

Description

@maaslalani

Describe the bug

gh repo list table is misaligned when rendering emojis.

> gh --version
gh version 2.48.0 (1980-01-01)
https://github.com/cli/cli/releases/tag/v2.48.0

Steps to reproduce the behavior

  1. Execute:
gh repo list
  1. View output, there is a misaligned row when emoji is in description.

Expected vs actual behaviour

image

Column should be aligned, regardless of emojis.

Activity

  1. added
    gh-reporelating to the gh repo command
    priority-3Affects a small number of users or is largely cosmetic
    on Apr 29, 2024
  2. williammartin commented on Apr 29, 2024

    @williammartin
    Member

    Taking a bet here I bet we're doing something like counting bytes or runes and the emoji is being counted as > 1 space.

  3. maaslalani commented on Apr 29, 2024

    @maaslalani
    Author

    @williammartin Yeah, I believe the DisplayWidth is not accounting for multiwidth runes correctly, made a PR in go-gh to fix that:

  4. williammartin commented on Apr 29, 2024

    @williammartin
    Member

    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-gh and bump it here, so I'm reopening it.

  5. maaslalani commented on Apr 29, 2024

    @maaslalani
    Author

    This is also a good write up about Grapheme Clustering: https://mitchellh.com/writing/grapheme-clusters-in-terminals

  6. mxie commented on Apr 30, 2024

    @mxie
    Member

    👋 Now that go-gh has been released and it's been bumped up in gh 2.49.0 today, can we consider this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-reporelating to the gh repo commandneeds-triageneeds to be reviewedpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions