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

Bug with -w and newline in pattern #444

Closed epa closed 10 years ago

epa commented 10 years ago

If the search pattern ends with a newline then -w misbehaves:

% mkdir n; cd n
% echo abcde >foo
% ack -w bcd
% ack -w 'bcd|
'
foo
1:abcde

Here the last command typed contains a newline between '' characters.

(While I agree that a newline in a pattern is an unusual case, it is not impossible, and a correct program is one that works on all inputs, not just the more likely ones. If newline in patterns is not supported then it would be better to give a warning.)

epa commented 10 years ago

Apologies, I need to do some more thinking on this.