Skip to content

l command: honor the -l wrap width - #552

Open
SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:fix-l-command-wrap-width
Open

l command: honor the -l wrap width#552
SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:fix-l-command-wrap-width

Conversation

@SichenLiang

Copy link
Copy Markdown

Fixes #551.

Out of scope and unchanged here: how l renders a newline inside the pattern space, and --posix accepting the l n argument. GNU also derives the default width from a COLS environment variable; its manual does not document that, so this implements the documented default of 70.

The l command ignored -l N and instead took its wrap width from
terminal_size(). As a result, output depended on the terminal size and
differed between a pipe and a tty. Use ProcessingContext::length, which
already defaults to 70.

GNU sed calls the option -l N, --line-length=N, while we exposed it as
--length. Add --line-length and retain --length as a hidden alias for
compatibility.

A width of 0 means never wrap. In that case, ListLine now periodically
flushes its buffer instead of accumulating the entire rendered line.
Add OutputBuffer::write_partial_str for these partial writes, since
write_str may defer a trailing newline.

This removes the crate's last direct use of terminal_size, so drop the
direct dependency from [dependencies] and [workspace.dependencies].
The package remains in the dependency tree through clap_builder and
textwrap.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

GNU sed testsuite comparison:

Test results comparison:
  Current:   TOTAL: 65 / PASSED: 15 / FAILED: 42 / SKIPPED: 8
  Reference: TOTAL: 65 / PASSED: 14 / FAILED: 43 / SKIPPED: 8

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + 8to7

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.95833% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.05%. Comparing base (77f442d) to head (e1e8e53).

Files with missing lines Patch % Lines
src/sed/fast_io.rs 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #552      +/-   ##
==========================================
+ Coverage   83.04%   83.05%   +0.01%     
==========================================
  Files          13       13              
  Lines        7046     6946     -100     
  Branches      401      403       +2     
==========================================
- Hits         5851     5769      -82     
+ Misses       1192     1174      -18     
  Partials        3        3              
Flag Coverage Δ
macos_latest 84.18% <98.95%> (+0.50%) ⬆️
ubuntu_latest 84.40% <98.95%> (+0.51%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

codspeed-hq Bot commented Sep 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.14%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 10 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
number_fix 1.1 s 1.3 s -12.14%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing SichenLiang:fix-l-command-wrap-width (e1e8e53) with main (77f442d)

Open in CodSpeed

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.

l command: the wrap width comes from the terminal size, and -l is ignored

1 participant