Hello Charles,

I think that all matches should be printed, even the empty ones.
And the same holds for --colour; if an automated system tries to
parse the colour tags (emacs, for example), it should get all
matches.

Basically, I'd start with the patch below.

Stepan
Index: src/grep.c
===================================================================
RCS file: /cvsroot/grep/grep/src/grep.c,v
retrieving revision 1.112
diff -u -r1.112 grep.c
--- src/grep.c  7 Jul 2005 05:32:30 -0000       1.112
+++ src/grep.c  23 Aug 2005 10:03:11 -0000
@@ -799,6 +799,12 @@
       PR_SGR_END_IF(grep_color);
       if (only_matching)
        fputs("\n", stdout);
+
+      /* Make minimal progress; there may be further non-empty matches.  */
+      /* XXX - Could really advance by one whole multi-octet character.  */
+      if (match_size == 0)
+       match_size = 1;
+
       beg = b + match_size;
       ibeg += match_offset + match_size;       /* XXX */
     }

Reply via email to