beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

Adding capture parenthesis interferes with coloring output #276

Closed rkleemann closed 11 years ago

rkleemann commented 11 years ago
$ echo foobar | ack 'foobar' -
foobar
$ echo foobar | ack '((foo)bar)' -
foobar[0m
$ echo foobar | ack '((foo)(bar))' -
foobar[0m

Adding capturing parenthesis to a search pattern can cause the match to be incorrectly highlighted, and worse, adding parenthesis around the pattern can throw in a mysterious [0m. Experimenting with the -o flag seems to produce the correct output without the [0m, so this is likely limited to the highlighting code. Experimenting with non-capturing parenthesis (?: ) produces the correct output also.

The pattern (foo)bar will highlight the foo, but not the bar. The pattern foo(bar) will highlight the bar, but not the foo. Both patterns ((foo)bar) and ((foo)(bar)) will add the additional [0m, but the latter will also highlight the [0m in addition to the foobar.

$ ack --version
ack 2.04
Running under Perl 5.12.4 at /usr/bin/perl
hoelzro commented 11 years ago

@rkleemann Great catch! I'll look at this after work today.

rkleemann commented 11 years ago

@hoelzro I haven't seen any action on this in a couple of weeks. What's going on with it?

hoelzro commented 11 years ago

@rkleemann Sorry; I've been swamped with vim-perl work for the last few weeks. Things should quiet down in a week or so.

rkleemann commented 11 years ago

Good luck, I'll look forward to your completion soon.

I just wanted to make sure it didn't get dropped.

On Fri, May 24, 2013 at 3:43 PM, Rob Hoelz notifications@github.com wrote:

@rkleemann https://github.com/rkleemann Sorry; I've been swamped with vim-perl work for the last few weeks. Things should quiet down in a week or so.

— Reply to this email directly or view it on GitHubhttps://github.com/petdance/ack2/issues/276#issuecomment-18434049 .

hoelzro commented 11 years ago

Fixed!

petdance commented 11 years ago

This is going in 2.06.