[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejec
From: |
Charles Levert |
Subject: |
Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected) |
Date: |
Sun, 13 Nov 2005 16:03:14 -0500 |
User-agent: |
Mutt/1.4.1i |
* On Sunday 2005-11-13 at 17:36:03 +0000, Julian Foad wrote:
> Charles Levert wrote:
> >You can see by my design of the GREP_COLORS
> >framework that I just plain forgot about -v and
> >confused things:
> >
> > ml: terminfo-like string capability for matching lines
> > cx: terminfo-like string capability for context lines
> [...]
> >Should I have created something like this:
> >
> > ml: terminfo-like string capability for matching lines
> > nl: terminfo-like string capability for non-matching lines
> >
> >Or, like this:
> >
> > sl: terminfo-like string capability for selected lines
> > rl: terminfo-like string capability for rejected lines
>
> This last pair, roughly; certainly the first of the pair should be
> "selected" and not "matching".
>
> The two sorts of lines that Grep prints (and which should be
> distinguishable by colour) are the ones it was asked to find (selected
> lines), and context lines (which are some of the rejected lines). It only
> prints rejected lines if and when they are context lines. Therefore I
> think it is clearer to call the printed non-selected lines "context lines"
> rather than "rejected lines":
I'd like to define "rejected" somewhere, just
because it's a term that covers all non-selected
lines, not just their printed subset, but
"context" is indeed more accurate for this
very subset. Maybe the full manual could have
a "Concepts and Terminology" @section in the
"Introduction" @chapter, or something.
> sl: terminfo-like string capability for selected lines
> cx: terminfo-like string capability for context lines
>
> [...]
> >Is it too late to just incompatibly change this,
> >since there hasn't been an offical release
> >since the ill-designed version was introduced?
>
> No, it's not too late.
One consequence to document is that now,
both sl and cx must be able to "support" mt.
By this I mean that the code intentionally does
sgr_start(sl or cx)
fwrite(non-matched text)
/* no sgr_end() here */
sgr_start(mt)
fwrite(matched text)
sgr_end()
sgr_start(sl or cx)
fwrite(non-matched text)
sgr_end()
fputs("\n")
for matching lines, so users must choose their
colors compatibly (e.g., if mt doesn't specify
a background color but sl and cx do).
> This is all experimental until we release it. I'm
> glad you discovered this problem before we have made a release.
I noticed that grep.el currently does
GREP_COLORS="...:ml=:cx=:...". I designed
parse_grep_colors() to ignore unknown
capabilities, so now the legacy empty ml= would
just be ignored which corresponds to its default
being empty. We can notify the grep.el people
of the change, as they seem to be the single
early adopters.
- tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Charles Levert, 2005/11/13
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Julian Foad, 2005/11/13
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Charles Levert, 2005/11/13
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Julian Foad, 2005/11/13
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Charles Levert, 2005/11/13
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Julian Foad, 2005/11/14
- Re: tests/yesno.sh, kinds of line (matching/non-matching, selected/rejected), Charles Levert, 2005/11/14