Skip to content

Complete textwrap.wrap() with 6 missing params!#207

Merged
jquast merged 1 commit intomasterfrom
jq/more-wrap-options
Feb 6, 2026
Merged

Complete textwrap.wrap() with 6 missing params!#207
jquast merged 1 commit intomasterfrom
jq/more-wrap-options

Conversation

@jquast
Copy link
Owner

@jquast jquast commented Feb 6, 2026

Make available all keyword parameters for wcwidth.wrap() as textwrap.wrap().

New Parameters expand_tabs, replace_whitespace, fix_sentence_endings, drop_whitespace, max_lines, and placeholder for wrap(), completing stdlib textwrap.wrap() compatibility.

Code mostly for 'drop_whitespace' and 'placeholder', and, that I found a very peculiar bug in standard python's textwrap fix_sentence_endings, that '\n' is "of length 1" -- anyway this argument is rarely used -- the other parameters simply needed to be "wired in", I forgot them!

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 6, 2026

Merging this PR will not alter performance

✅ 64 untouched benchmarks


Comparing jq/more-wrap-options (1ee7f15) with master (666c501)

Open in CodSpeed

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (666c501) to head (1ee7f15).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #207   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          986      1030   +44     
  Branches       247       263   +16     
=========================================
+ Hits           986      1030   +44     

☔ View full report in Codecov by Sentry.
📢 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.

@jquast jquast marked this pull request as ready for review February 6, 2026 16:58
@jquast jquast force-pushed the jq/more-wrap-options branch 2 times, most recently from 40d2ccc to fd42dd3 Compare February 6, 2026 17:03
**New** Parameters ``expand_tabs``, ``replace_whitespace``, ``fix_sentence_endings``,
``drop_whitespace``, ``max_lines``, and ``placeholder`` for ``wrap()``, completing stdlib
``textwrap.wrap()`` compatibility.

Wrote code mostly for 'drop_whitespace' and 'placeholder', and found a
very peculiar bug in standard python's textwrap fix_sentence_endings,
that '\n' is "of length 1" -- the other parameters simply needed to be
"wired in".
@jquast jquast force-pushed the jq/more-wrap-options branch from fd42dd3 to 1ee7f15 Compare February 6, 2026 19:16
@jquast jquast merged commit e19d2a2 into master Feb 6, 2026
39 checks passed
@jquast jquast deleted the jq/more-wrap-options branch February 6, 2026 19:18
jquast added a commit to jquast/blessed that referenced this pull request Feb 6, 2026
Bugfix by integration with wcwidth.width() 0.6.0, just released, jquast/wcwidth#207

Closes #351.
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.

1 participant

Comments