Skip to content

Conversation

@pocopepe
Copy link
Contributor

Closes #143

This fixes the p command so it matches GNU sed’s outputline() behavior.

write_chunk() now writes the line content without a trailing newline, and only appends \n if the original input line was newline-terminated (GNU’s chomped = true case). With this in place, the p command can simply call write_chunk() directly without any special handling.

To fully mirror GNU sed, this newline logic would ideally apply to all write_chunk() calls. However, doing so changes existing output behavior and breaks a large number of tests that currently depend on the old semantics. For now, this change is intentionally scoped to p to fix the reported issue without introducing broader regressions.

@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.26%. Comparing base (d57fca0) to head (d76dfd8).

Files with missing lines Patch % Lines
src/sed/processor.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #213      +/-   ##
==========================================
- Coverage   82.31%   82.26%   -0.05%     
==========================================
  Files          13       13              
  Lines        5371     5374       +3     
  Branches      293      294       +1     
==========================================
  Hits         4421     4421              
- Misses        948      951       +3     
  Partials        2        2              
Flag Coverage Δ
macos_latest 82.70% <0.00%> (-0.05%) ⬇️
ubuntu_latest 82.81% <0.00%> (-0.05%) ⬇️
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 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.

@sylvestre
Copy link
Contributor

please add a test to make sure we don't regress in the future

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.

Missing newline in output with -e p

2 participants