beyondgrep / ack2

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

--context and files with carriage returns #597

Closed epa closed 4 years ago

epa commented 8 years ago

If a file contains carriage returns but you are running on a Unix-like system, then ack --context can print its results in such a way that some lines become invisible.

% mkdir test
% cd test
% perl -E 'print "hello\r\n" foreach 1, 2' >out
% ack --context=1 hello
out
1:hello

% ack hello out
1:hello
2:hello

Observe that when --context is given, only the first match is visible on screen.

petdance commented 8 years ago

What does grep do in such a case?

epa commented 8 years ago

grep prints both lines. I think this is something to do with --color. If you give --no-color then the result is as expected.

petdance commented 4 years ago

We redid how colorzing works in ack 3. This works in ack 3. There will be no more releases of ack 2.