bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#43702: Emacs master: Incorrect highlighting in regexp isearch.


From: Drew Adams
Subject: bug#43702: Emacs master: Incorrect highlighting in regexp isearch.
Date: Thu, 1 Oct 2020 15:41:48 -0700 (PDT)

FWIW, attached are three screenshots using Isearch+
for the same regexp search as Juri's screenshot, and
starting with emacs -Q (just loading isearch+.el).

I can't tell from Juri's screenshot just what regexp
he used.  Seven regexp groups are shown in the echo
area, but the non-lazy highlighting seems to show 13
groups.

The first two attached screenshots are with 7 and 13
groups, respectively.  They show the default
highlighting for both the current search hit and the
other search hits (lazy highlighting).

I think you can see the advantage of having lazy
highlighting indicate groups, at least in a gross
way (even/odd).

Because Isearch+ has only 8 group faces defined,
matches beyond the 8th are not indicated in the
current search hit, in these first two screenshots.

As I mentioned, it's simple to just repeat the use
of the same 8 faces, for 9-16, 17-24, etc.  But
that won't help you distinguish group 1 from group
9 etc.

I've added a third screenshot, where I did this:
recycle the faces of groups 1-5 for groups 9-13.
___

The faces for the overall current search hit and
the even lazy-highlight hits are the vanilla
default faces, `isearch' and `lazy-highlight'.

The default values of the group faces are also
used.  By default, only the background color is
defined for each group face.

The foreground for each group is apparently taken
from the foreground of face `isearch'.  I guess I
hadn't paid attention to that.  I think that's
unfortunate, in general.  I probably didn't notice
it because in my own setup I've customized face
`isearch' to use a black foreground (and a green
background).

I think the default foreground for face `isearch'
should be something that works well with each of
the default group faces, and that's not likely to
be `lightskyblue1'.  Change it to `black' and the
regexp group highlighting is quite good.  You need
to be able to see the text that the regexp parts
apply to.

I also tried just removing a foreground spec from
the vanilla default for face `isearch'.  In the
case shown, which is *scratch*, the text has face
`font-lock-comment-face'.  And if face `isearch'
doesn't have a good foreground spec (e.g. `black')
then the result isn't great.  (But at least it's
better than with foreground `lightskyblue1'.)

As I've just noticed this problem now, and as I
don't want to impose any default change on face
`isearch' in my code, I've now changed the default
regexp group faces to each specify a `black'
foreground (instead of no foreground), for a light
background mode.

The third screenshot (which recycles faces 1-5 for
9-13) shows this: a black foreground for each face
used for the current search hit (but not for lazy
highlighting).
___

The regexp used by Juri is extremely atypical, IMO.

A more typical regexp that uses multiple groups
involves some group nesting, and in that case there's
little (typically no) problem distinguishing group 1
from group 9, group 2 from group 10, etc.

Attachment: throw-emacs-isearch+-regexp-highlighting.png
Description: PNG image

Attachment: throw-emacs-isearch+-regexp-highlighting-2.png
Description: PNG image

Attachment: throw-emacs-isearch+-regexp-highlighting-3.png
Description: PNG image


reply via email to

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