feat: add m/M substitute flag#431
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #431 +/- ##
==========================================
+ Coverage 82.20% 82.32% +0.11%
==========================================
Files 13 13
Lines 5542 5584 +42
Branches 310 312 +2
==========================================
+ Hits 4556 4597 +41
- Misses 983 984 +1
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dspinellis
left a comment
There was a problem hiding this comment.
Great work! I added suggestions for a few small changes. To finish this feature please also consider the required support for the special character sequences (` and ') which always match the beginning or the end of the buffer. If this works now, just add the corresponding integration tests. Otherwise, I suggest doing this in a separate PR.
| line.advance(); | ||
| } | ||
|
|
||
| 'm' | 'M' => { |
There was a problem hiding this comment.
This is a GNU extension, so report an error if running under strict POSIX mode.
| } | ||
|
|
||
| #[test] | ||
| fn test_compile_re_multiline() { |
| .arg("N;s/^./X/gm") | ||
| .pipe_in("foo\nbar\n") | ||
| .succeeds() | ||
| .stdout_is("Xoo\nXar\n"); |
Summary
m/Msubstitute flag parsing(?m)when multiline mode is requested^and$matching around embedded newlines plus compiler flag/unit coverageFixes #399.
Tests
cargo fmt --checkcargo test subst_multiline_flagcargo test test_compile_re_multilinecargo test test_compile_subst_flag_mcargo test test_sedcargo testprintf 'foo\nbar\n' | cargo run --quiet -- 'N;s/^./X/gm'