03: Migrate src/render/team-pick.ts to use visibleWidth and clipToWidth - #162
Merged
shouze merged 2 commits intoAug 23, 2026
Merged
Conversation
shouze
force-pushed
the
feat/bun14-terminal/03-team-pick
branch
from
August 23, 2026 15:45
0930584 to
a6e00e6
Compare
|
Coverage after merging feat/bun14-terminal/03-team-pick into feat/bun14-terminal/02-render will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 similar comment
|
Coverage after merging feat/bun14-terminal/03-team-pick into feat/bun14-terminal/02-render will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates team-pick rendering to terminal-aware width measurement and clipping for Unicode and ANSI-safe output.
Changes:
- Uses
visibleWidthfor candidate sizing. - Uses
clipToWidthfor focused-item truncation.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Replace t.length with visibleWidth(t) for accurate team name width measurement - Handle emoji and CJK characters correctly in team pick sliding window - Replace .slice() truncation with clipToWidth() for Unicode-safe clipping - Add tests for candidate teams with emoji, CJK, and complex grapheme sequences - Verify team name wrapping respects actual terminal column width Fixes: #143
Fixes: 1. Keep ellipsis styled with bold/magenta when clipping focused team name. Previously, clipToWidth added a partial reset that moved the ellipsis outside the bold/magenta style; now the styled text is clipped first, then a styled ellipsis is appended. 2. Use visibleWidth() instead of .length when computing padding for the team-pick bar in render.ts. This prevents over-padding with CJK team names (where JS .length ≠ terminal columns). 3. Add comprehensive test coverage for CJK and emoji team names: - Width measurement with Chinese characters (2 cols each) - Clipping behavior with wide characters - Ellipsis styling preservation - Mixed ASCII/emoji team names - Window rendering with wide character constraints All 29 team-pick tests and 153 render tests passing.
shouze
force-pushed
the
feat/bun14-terminal/03-team-pick
branch
from
August 23, 2026 16:05
a6e00e6 to
2ac87cd
Compare
|
Coverage after merging feat/bun14-terminal/03-team-pick into feat/bun14-terminal/02-render will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
What does this PR do?
How did you verify your code works?