fix(cli): align Unicode table columns - #13
Merged
aprylewu merged 1 commit intoSep 7, 2026
Conversation
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.
This was referenced Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sustech tis gradesshifts 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.string-widthwith explicit narrow ambiguous-width handling for both truncation and padding.The fix applies to tables using the shared text renderer. JSON/JSONL data and command behavior are unchanged.
Validation
npm run checkandnpm 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 existingcontext live supports calendar level and degrades gracefully when credentials are unavailabletest still fails because its public academic-calendar request times out atraw.githubusercontent.com; reproduced separately withNETWORK_ERROR, including outside the sandbox.npm pack --dry-run --ignore-scripts --json— passed (290 packaged files); lifecycle checks were run separately as listed above.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.