Skip to content

Conversation

@AlexanderWangY
Copy link

Fixes #254

  • On exchange where hold space is empty, we ignore exchanging the newline.
  • Only when the hold space is filled or the hold space has a newline do we exchange the newline
  • Added test case

Note: It got me thinking, will there ever be a case where we exchange a line and have the new space be part of the line itself? It seems as if we won't really have to set it.

@github-actions
Copy link

GNU sed testsuite comparison:

Test results comparison:
  Current:   TOTAL: 64 / PASSED: 8 / FAILED: 56 / SKIPPED: 0
  Reference: TOTAL: 64 / PASSED: 8 / FAILED: 56 / SKIPPED: 0

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.07%. Comparing base (1710d9c) to head (dfc3c5f).

Files with missing lines Patch % Lines
src/sed/processor.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #259      +/-   ##
==========================================
- Coverage   82.11%   82.07%   -0.04%     
==========================================
  Files          13       13              
  Lines        5327     5329       +2     
  Branches      294      295       +1     
==========================================
  Hits         4374     4374              
- Misses        951      953       +2     
  Partials        2        2              
Flag Coverage Δ
macos_latest 82.51% <0.00%> (-0.04%) ⬇️
ubuntu_latest 82.63% <0.00%> (-0.04%) ⬇️
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.

// Exchange the contents of the pattern and hold spaces.
let (pat_content, pat_has_newline) = pattern.fields_mut()?;
if !context.hold.content.is_empty() || context.hold.has_newline {
std::mem::swap(pat_has_newline, &mut context.hold.has_newline);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment explaining what it is doing

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.

handles exchange command (x) with empty hold space differently from GNU (missing newline)

2 participants