bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] selected/context colors


From: Julian Foad
Subject: Re: [patch] selected/context colors
Date: Mon, 14 Nov 2005 12:58:20 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Charles Levert wrote:
Here is the selected/context colors patch, as discussed.
Nothing else that was discussed is touched by this.

I have attached a screen shot to be sure this
is what everybody understands and wants.

Thanks very much for the good, helpful screen shot.

+       * src/grep.c (print_line_middle, prline): Change logic so that
+         lines with matches have their matched part properly handled ("mt"
+         color or --only-matching), whether -v or not -v.

Ah - no, I didn't expect to see matches highlighted where they appear in context lines. I think "grep -C3 -v s" means "show me the lines that don't contain an "s", with a few lines of context around them." I don't want all the esses in the context lines to be highlighted; that's just a distraction from the parts that I want to see.

I can understand your point of view too, and I'm not absolutely 100% stuck on my current point of view, but I'd like to see some evidence, realistic examples or reasoning to convince me that highlighting matches in context lines is often useful and not often a distraction.

There will be some cases where it is definitely useful, and some cases where it is definitely a distraction. If we can't be sure that one way or the other is both useful and safe (avoids annoying people) then we need to have a colour configuration option for it, making four related capabilities:

  selected-line    matched-text-in-selected-line
  context-line     matched-text-in-context-line

In fact, I can't see any drawback to having that set of capabilities.

(A detail: the old "GREP_COLOR" option should override "matched-text-in-selected-line" only, since no highlighting used to be done on context lines.)


Secondly, the log entry indicates that this patch also changes the behaviour of "-o". We're discussing that in another thread and it shouldn't be done until we've decided.

- Julian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]