acheronfail / repgrep

An interactive replacer for ripgrep that makes it easy to find and replace across files on the command line.
Apache License 2.0
267 stars 4 forks source link

Collapsing whitespace doesn't work when non-whitespace characters are matched #57

Closed acheronfail closed 3 years ago

acheronfail commented 3 years ago

Reproduce:

printf "bar\nbar\n\nbarbar\n" > foo
rgr -U 'bar(\n)*' ./foo

After changing how whitespace is rendered, modes c or a should result in the match collapsing into a single line.

acheronfail commented 3 years ago

This is actually invalid - the above example results in multiple matches, and the collapsing whitespace behaviour only applies for matches.

For example:

printf "bar\nbar\n\nbarbar\n" > foo
rgr -U '(bar\n?)+' ./foo