Skip to content

feat(rg): add crlf mode - #1663

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

chaliy merged 1 commit into
mainfrom
2026-05-22-rg-crlf

Conversation

@chaliy

@chaliy chaliy commented May 22, 2026

Copy link
Copy Markdown
Contributor

What

Add rg --crlf / --no-crlf support so CRLF input can match anchors before the carriage return while preserving original CRLF output.

Why

Real ripgrep supports CRLF-aware matching. Bashkit rg previously stripped CR before matching unconditionally, which diverged from real rg for patterns like needle$.

How

  • Track a CRLF option in rg parsing and help text.
  • Split line display text from match text, preserving CR for output while stripping it only for --crlf matching.
  • Apply replacements against the match view and reattach the display suffix.
  • Add data-driven real-rg differential cases for default behavior, --crlf, --no-crlf ordering, output preservation, and replacement.

Risk

  • Low
  • Touches rg line matching/output formatting; covered by focused rg tests, real-rg differential tests, and full pre-pr.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@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 8d145e4 Commit Preview URL May 22 2026, 07:43 AM

@chaliy
chaliy merged commit 2e7dc80 into main May 22, 2026
34 checks passed
@chaliy
chaliy deleted the 2026-05-22-rg-crlf branch May 22, 2026 07:56
chaliy added a commit that referenced this pull request May 30, 2026
## What
Add rg --crlf / --no-crlf support so CRLF input can match anchors before
the carriage return while preserving original CRLF output.

## Why
Real ripgrep supports CRLF-aware matching. Bashkit rg previously
stripped CR before matching unconditionally, which diverged from real rg
for patterns like needle$.

## How
- Track a CRLF option in rg parsing and help text.
- Split line display text from match text, preserving CR for output
while stripping it only for --crlf matching.
- Apply replacements against the match view and reattach the display
suffix.
- Add data-driven real-rg differential cases for default behavior,
--crlf, --no-crlf ordering, output preservation, and replacement.

## Risk
- Low
- Touches rg line matching/output formatting; covered by focused rg
tests, real-rg differential tests, and full pre-pr.

## Checklist
- [x] Tests added or updated
- [x] Backward compatibility considered
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