Skip to content

Long player names break the high score table alignment #22

Description

@pushpam2404

Context

format_scoreboard() truncates names to 14 characters with [:14], which stops
the columns shifting — but it cuts mid-word with no indication anything was
removed, so "Venkateswara Rao" becomes "Venkateswara R" and looks like a typo.

There is a second problem: a name containing a wide character (many emoji, or
CJK text) takes two terminal columns but counts as one character, so the row
still ends up misaligned.

What to change

File: arcade/scoreboard.py
Function: format_scoreboard()

  • Truncate with an ellipsis so it is obvious text was cut: Venkateswara…
  • Handle wide characters. unicodedata.east_asian_width() tells you whether a
    character occupies two columns — count display width, not character count
  • Keep every row the same rendered width

unicodedata is in the standard library, so this adds no dependency.

Acceptance criteria

  • Truncated names end with an ellipsis
  • A name with wide characters does not break alignment
  • Every row of the table is the same rendered width
  • Short names are unaffected
  • Tests cover: a long ASCII name, a name with wide characters, a short name
  • python3 -m pytest passes

How to verify locally

python3 -m pytest tests/test_scoreboard.py -v
python3 -m arcade     # save a score under a very long name, view the board

Difficulty

Intermediate. Terminal width handling is genuinely fiddly and worth learning.


New here? Comment /claim on this issue and a bot will assign it to you. Then read CONTRIBUTING.md.

Stuck at any point? Comment here saying what you have tried, or come to a PR Debug Clinic (Oct 12 or Oct 21). Getting stuck is the normal experience of learning this, not a sign you are doing it wrong.

Activity

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 is brokendifficulty: intermediateRequires reading existing codedomain: os-devxOpen Source & Developer ExperiencehacktoberfestCounts toward Hacktoberfest 2026

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions