Repository navigation
grep: check -w and -x against full match start before \K - #252
yunusarda-sudo wants to merge 1 commit into
Conversation
Keep the regex match start returned by Oniguruma search separate from region group 0's start (which \K resets) so -w and -x validate the full match while -o and highlighting still use the reported span after \K. Fixes uutils#181
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #252 +/- ##
==========================================
- Coverage 97.19% 97.16% -0.04%
==========================================
Files 6 6
Lines 2248 2254 +6
Branches 243 244 +1
==========================================
+ Hits 2185 2190 +5
- Misses 63 64 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performanceWarning uutils has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 1 warning
Comparing Footnotes
|
In
-Pmode,\Kresets the start of the reported match inregion.pos(0), whileOnigRegex::searchreturns the actual start of the full match.Previously,
CompiledPattern::search_leftmostdiscarded the return value ofsearchand usedregion.pos(0)for everything, causing-wand-xto test only the portion after\K(andlongest_end_atto anchor at the trimmed start).This introduces
MatchSpan { match_start, report_start, end }so-w/-xandlongest_end_atusematch_start, while-o/ highlighting continue to usereport_start..end.Fixes #181
Investigated and verified locally with
cargo fmt --check,cargo clippy --all-targets -- -D warnings, andcargo test.