Skip to content

Measure hyphen break positions by display width - #262

Merged
jquast merged 2 commits into
masterfrom
jq/wrap-hyphen-display-width
Sep 20, 2026
Merged

jquast merged 2 commits into
masterfrom
jq/wrap-hyphen-display-width

Conversation

@jquast

@jquast jquast commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Follows up #261 with performance fix, more tests, changelog item

Original description:

wrap('古古-1abcdef', 4) currently produces a first line of 古古-, which occupies five columns. The
hyphen search compares codepoint positions with the available display width. It also misses valid
hyphen breaks after combining characters.

Find the prefix that fits using the existing grapheme-aware width helper, then search that prefix
for the last hyphen. Adds regression cases for CJK text, combining marks, and wide emoji.

Validation: the full test suite passes on Python 3.8–3.14 and 3.15rc (1605 passed, 11 optional
data-fixture skips per version). All CI lint, formatting, type, documentation, and package checks
pass.

Closes #261

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (329d19c) to head (f261f81).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #262   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2008      2008           
  Branches       469       468    -1     
=========================================
  Hits          2008      2008           

☔ 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.

@codspeed

codspeed Bot commented Sep 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 119 untouched benchmarks


Comparing jq/wrap-hyphen-display-width (f261f81) with master (329d19c)

Open in CodSpeed

@jquast
jquast merged commit d87b6a3 into master Sep 20, 2026
36 checks passed
@jquast
jquast deleted the jq/wrap-hyphen-display-width branch September 20, 2026 20:55
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