Skip to content

fix(wcwidth): measure wcwidth per codepoint - #933

Merged
andrinoff merged 2 commits into
charmbracelet:mainfrom
andrinoff:fix/wcwidth
Aug 11, 2026
Merged

fix(wcwidth): measure wcwidth per codepoint#933
andrinoff merged 2 commits into
charmbracelet:mainfrom
andrinoff:fix/wcwidth

Conversation

@andrinoff

@andrinoff andrinoff commented Aug 3, 2026

Copy link
Copy Markdown
Member

What?

FirstGraphemeCluster measures a cluster under WcWidth by handing it to go-runewidth's StringWidth, which reports the width of the cluster's first non-zero-width rune. That is a grapheme measurement, not a wcwidth one. It now sums the cluster's codepoints

Why?

Fixes charmbracelet/bubbletea#1737


Fixes CHARM-1896

related charmbracelet/ultraviolet#150

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.45455% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.59%. Comparing base (240ce7b) to head (63a572c).

Files with missing lines Patch % Lines
ansi/parser_decode.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #933      +/-   ##
==========================================
+ Coverage   48.00%   53.59%   +5.59%     
==========================================
  Files         181       55     -126     
  Lines       13129     3351    -9778     
==========================================
- Hits         6302     1796    -4506     
+ Misses       6433     1493    -4940     
+ Partials      394       62     -332     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrinoff
andrinoff force-pushed the fix/wcwidth branch 3 times, most recently from 0ef2e18 to f6f7b2a Compare August 11, 2026 14:27
Signed-off-by: drew <me@andrinoff.com>
Signed-off-by: drew <me@andrinoff.com>
@andrinoff
andrinoff merged commit 00c6608 into charmbracelet:main Aug 11, 2026
9 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.

v2: rendering Hindi completely broken

1 participant