On Tue, Apr 24, 2018 at 1:07 AM, Taylor Blau <m...@ttaylorr.com> wrote:
> To prepare for 'git grep' learning '--column-number', teach grep.c's
> show_line() how to show the column of the first match on non-context
> line.
>
> Signed-off-by: Taylor Blau <m...@ttaylorr.com>
> ---
> diff --git a/grep.c b/grep.c
> @@ -1399,6 +1399,17 @@ static void show_line(struct grep_opt *opt, char *bol, 
> char *eol,
> +       /**
> +        * Treat 'cno' as the 1-indexed offset from the start of a non-context
> +        * line to its first match. Otherwise, 'cno' is 0 indicating that we 
> are
> +        * being called with a context line.
> +        */

Nit: Ævar's review[1] mentioned that this project tends to use
/*...*/, not /**...*/.

[1]: https://public-inbox.org/git/874lk2e4he....@evledraar.gmail.com/

> +       if (opt->columnnum && cno) {
> +               char buf[32];
> +               xsnprintf(buf, sizeof(buf), "%d", cno);
> +               output_color(opt, buf, strlen(buf), opt->color_columnno);
> +               output_sep(opt, sign);
> +       }

Reply via email to