|
From: | Julian Foad |
Subject: | Re: --only-matching interacts badly with context lines and line head [bug-grep] |
Date: | Wed, 23 Feb 2005 10:05:05 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a6) Gecko/20050111 |
Charles Levert wrote:
First, it is obvious that --only-matching does not agree with context lines. I propose the following wholesale fix in main(): if (only_matching) out_after = out_before = 0;
Good point, though we probably should error rather than silently ignore part of the user's command.
I propose that a line head, if any is specified, be printed before each match.
I agree.
Third, assuming the previous proposal is retained, I propose that combining --only-matching and --byte-offset print the byte offset of every match itself, as opposed to the byte offset of the beginning of the line on which each match appears.
I agree.
I plan to update my patch at <https://savannah.gnu.org/patch/index.php?func=detailitem&item_id=3644> to implement these proposals, since these affect mostly the same lines that are already heavily modified by the patch. It will always remain possible to ignore this specific version of the patch and use a previous one.
I appreciate your keenness to provide a patch, but please don't combine it. I understand your point about it modifying mostly the same lines, but a combined patch will be too hard to review, and would not be suitable for committing to CVS anyway, so it would be of little use. Instead, let's try to get your existing patch (or parts of it) either committed or rejected, and continue from there, or else write this new bug-fix patch and get it committed (which should be quick, because these bugs are fairly unarguable) and then adapt your patch #3644 to apply on top of these fixes.
- Julian
[Prev in Thread] | Current Thread | [Next in Thread] |