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

Graphviz filetypes and issue 615 #625

Closed MarxBro closed 7 years ago

MarxBro commented 7 years ago

Wanted to exclude dot (gv) files from ack's search. Added that.

Then read this: https://github.com/petdance/ack2/issues/615. I believe the offset will be plus one on the current iteration if input contains '()', hence always colouring whatever it's inside as it is the last match. It is a very silly change, line 609:

my ( $match_start, $match_end ) = ( $-[$i-1], $+[$i-1] );

or just change the loop initial value to 0 instead of using 1 (if makes more sense to change it).

Now:

ack '(foo)bar' foo # Highlights "foobar"
ack 'is a (t.+t)' foo # Highlights "is a test"
ack 'is a ((((t)e)s)+t)' foo # Same as above

Regards.

MarxBro commented 7 years ago

This test fails: ADJACENT_CAPTURE_COLORING. It does what it should, however doesn't print the ANSI sequences according to the parentheses...

petdance commented 7 years ago

This is two different things, so I'm going to have to deal with them separately. For filetype additions, they need to have an issue posted in the GitHub repo that we can discuss. I can't automatically include every file type that someone asks for.