Skip to content

fix(cli): align Unicode table columns - #13

Merged
aprylewu merged 1 commit into
wormforce:mainfrom
KevinHuge:codex/fix-unicode-table-alignment
Sep 7, 2026
Merged

fix(cli): align Unicode table columns#13
aprylewu merged 1 commit into
wormforce:mainfrom
KevinHuge:codex/fix-unicode-table-alignment

Conversation

@KevinHuge

Copy link
Copy Markdown
Contributor

Summary

sustech tis grades shifts the grade, score, and credit columns one cell to the left for course names containing Unicode Roman numerals such as 体育Ⅴ, and for long names truncated with . The shared renderer currently treats every character above U+00FF as double-width, although these characters occupy one cell in terminals using narrow ambiguous-width characters.

  • Use string-width with explicit narrow ambiguous-width handling for both truncation and padding.
  • Iterate grapheme clusters when truncating so combining sequences and emoji remain intact.
  • Add synthetic grade-table regressions for Roman numerals, ellipses, full-width text, combining marks, and emoji; document the fix in the changelog.

The fix applies to tables using the shared text renderer. JSON/JSONL data and command behavior are unchanged.

Validation

  • macOS arm64, Node.js v26.4.0.
  • npm run check and npm run build — passed.
  • node --test dist/test/text.test.js — 3/3 passed; all three tests failed against the original renderer.
  • node scripts/run-tests.mjs — 319/320 passed, including all new regressions. The existing context live supports calendar level and degrades gracefully when credentials are unavailable test still fails because its public academic-calendar request times out at raw.githubusercontent.com; reproduced separately with NETWORK_ERROR, including outside the sandbox.
  • npm pack --dry-run --ignore-scripts --json — passed (290 packaged files); lifecycle checks were run separately as listed above.
  • Verified the installed renderer places the grade column at the same terminal-cell offset (62) for ASCII V, Unicode , and ellipsis-truncated names; previously these offsets were 62, 61, and 61.

Only synthetic grade fixtures are included; no personal academic records or credentials are attached.

Measure terminal cells with string-width instead of treating all non-Latin-1 characters as double-width. Preserve grapheme clusters during truncation and cover Roman numerals, ellipses, combining marks, and emoji with synthetic grade fixtures.
@aprylewu
aprylewu merged commit 8929805 into wormforce:main Sep 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants