Repository navigation
fix(adapter-core): board clip() measures display columns, not string length (bro-2r7f7) - #1186
Conversation
…length (bro-2r7f7) Wide glyphs (CJK, emoji) count as two terminal columns but slice() counted them as one — titles overflowed the board panel — and a cut inside an astral character split the surrogate pair. clip() now walks code points (for..of never splits pairs) against a wcwidth-lite column budget: zero-width combining marks and joiners, two-column wide and fullwidth ranges. displayWidth() exported for hosts that pad/align. Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
|
Warning Amazon Q Developer for GitHub: end of support On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026. For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Reviewer's GuideAPIExport
ImplementationAdd code-point width calculation and use it to clip without exceeding the column budget or splitting surrogate pairs, including in the regenerated plugin adapters.
TestsCover display-width clipping for wide glyphs, surrogate pairs, and combining marks.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Review Summary
This PR correctly fixes the core bug (string-length vs. display-column measurement, surrogate-pair safety via for..of) and the approach is sound. However, there is one blocking logic error in the charWidth implementation:
Critical — incomplete emoji range in charWidth
The wide-character check covers 0x1f300–0x1f64f but misses the transport/map block (0x1f680–0x1f6ff), supplemental symbols (0x1f900–0x1f9ff), and other widely-used emoji planes up to 0x1fffd. Emoji like 🚀, 🚗, 🛸, 🤔 all land in these gaps and are measured as 1 column, reproducing the exact overflow bug the PR claims to fix. The surrogate-pair test uses \u{1F680} (🚀) and labels it "width 2" in its comment, but the current code returns 1 for that code point — the test only passes by coincidence because its assertions don't directly verify the emoji's column width.
Two comments posted:
core.ts— fix the missing emoji ranges incharWidth.core.test.ts— add an explicitassert.equal(displayWidth(emoji), 2)assertion so the test actually enforces the intended behavior and would have caught the range gap.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 141 |
| Duplication | -1 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
This comment has been minimized.
This comment has been minimized.
|
Sorry @devin-ai-integration[bot], you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 5 days by commenting |
Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
amazon-q + macroscope on #1186: 1f300–1f64f misses transport/map (1f680–1f6ff, 🚀 included) and supplemental symbols — rockets measured 1 column and clip('🚀'×40) overflowed the board at 80 columns. Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
Devin Review🟢 Devin Review found nothing to fix · View findings |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by free · Input: 152.5K · Output: 10.2K · Cached: 872.4K Review guidance: REVIEW.md from base branch |
|



Summary
The
clipfunction inadapter-corenow respects terminal column width rather than string length. Wide characters (CJK, emoji, full‑width) count as two columns, combining marks as zero width, and surrogate pairs are never split. This prevents overflow when truncating text for display.Changes
charWidth(cp)to determine column width of a code point (0 for combining/zero‑width, 2 for wide ranges).displayWidth(text)returning total terminal columns.clip(text, width)to iterate code points, accumulate width, and stop before exceeding the budget, appending an ellipsis.Functional impact
Summary by Sourcery
Update adapter text clipping to measure visual terminal width instead of string length.
Bug Fixes:
Enhancements:
Tests: