ripgrep icon indicating copy to clipboard operation
ripgrep copied to clipboard

-A/-B completely overrides -C

Open jwilk opened this issue 2 years ago • 1 comments

What version of ripgrep are you using?

ripgrep 13.0.0
-SIMD -AVX (compiled)

How did you install ripgrep?

apt-get install ripgrep

What operating system are you using ripgrep on?

Debian unstable

Describe your bug.

The -A option completely overrides -C:

$ seq 1 10 | rg 5 -C1 -A2
5
6
7

What is the expected behavior?

The -A option should affect only trailing context. This is how it works in GNU grep:

$ seq 1 10 | grep 5 -C1 -A2
4
5
6
7

jwilk avatar Aug 22 '22 06:08 jwilk

Hmmm, interesting. I think I agree with how grep does things here.

The docs are at least correct from my perspective though, so I think today's behavior matches the intended behavior. So I'll mark this as an enhancement. It will be a breaking change, but it's the kind of breaking change that I think makes sense and I'm okay making.

BurntSushi avatar Aug 22 '22 12:08 BurntSushi