Skip to content

feat(rg): add context separator controls - #1674

Merged
chaliy merged 1 commit into
mainfrom
2026-05-22-rg-context-print0
May 22, 2026
Merged

chaliy merged 1 commit into
mainfrom
2026-05-22-rg-context-print0

Conversation

@chaliy

@chaliy chaliy commented May 22, 2026

Copy link
Copy Markdown
Contributor

What

Add rg --no-context-separator and real-rg separator escape decoding for --context-separator, --field-match-separator, and --field-context-separator.

Why

Continue closing rg parity gaps around context output formatting.

How

  • Track context separator suppression separately from empty separator strings, matching real rg behavior.
  • Decode common separator escapes like \t, \r, \n, \\, and valid \xNN.
  • Add data-driven differential tests with discontiguous context groups so separators are actually exercised.

Risk

  • Low / Medium
  • Scoped to rg context/field output formatting; separator byte handling is the main compatibility surface.

Checklist

  • Tests added or updated
  • Backward compatibility considered

Validation:

  • cargo fmt && cargo test -p bashkit builtins::rg::tests -- --nocapture
  • just pre-pr

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 54940bc Commit Preview URL May 22 2026, 12:05 PM

@chaliy
chaliy merged commit d7d06f5 into main May 22, 2026
41 of 44 checks passed
@chaliy
chaliy deleted the 2026-05-22-rg-context-print0 branch May 22, 2026 12:28
chaliy added a commit that referenced this pull request May 30, 2026
## What
Add `rg --no-context-separator` and real-rg separator escape decoding
for `--context-separator`, `--field-match-separator`, and
`--field-context-separator`.

## Why
Continue closing `rg` parity gaps around context output formatting.

## How
- Track context separator suppression separately from empty separator
strings, matching real rg behavior.
- Decode common separator escapes like `\t`, `\r`, `\n`, `\\`, and valid
`\xNN`.
- Add data-driven differential tests with discontiguous context groups
so separators are actually exercised.

## Risk
- Low / Medium
- Scoped to rg context/field output formatting; separator byte handling
is the main compatibility surface.

## Checklist
- [x] Tests added or updated
- [x] Backward compatibility considered

Validation:
- `cargo fmt && cargo test -p bashkit builtins::rg::tests --
--nocapture`
- `just pre-pr`
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.

1 participant