Skip to content

grep: avoid separators for adjacent context groups#42

Open
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/context-adjacent-groups
Open

grep: avoid separators for adjacent context groups#42
wondr-wclabs wants to merge 1 commit into
uutils:mainfrom
wondr-wclabs:codex/context-adjacent-groups

Conversation

@wondr-wclabs
Copy link
Copy Markdown
Contributor

Fixes #24.

When a later match pulls in before-context that starts immediately after the last printed line, the output groups are adjacent and should be merged. The old separator check compared the match line directly with the last printed line before draining before-context, so it inserted -- even though the next emitted context line closed the gap.

This uses the first buffered context line that will actually be printed as the group start, falling back to the match line when there is no pending context.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will not alter performance

✅ 10 untouched benchmarks
⏩ 17 skipped benchmarks1


Comparing wondr-wclabs:codex/context-adjacent-groups (ee6ef1e) with main (f4798cb)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

emits a spurious -- context separator between adjacent groups

1 participant