> I believe there are actually several different issues here,
Yes. - I agree.
> perhaps it's worth stating them explicitly to ensure we're
> on the same page.
I thank you for your very detailed answer.
> Grep's default coloring is red text and default background.
This setting can be fine in several use cases.
> But TAB (and space) are empty characters - they do not have text.
I know this detail also.
> Because the default background color is not changed,
Can this display detail be adjusted anyhow (like it is provided
by the tool “ack” by default)?
> you will not see them highlighted with a color.
This can trigger questionable interpretations of the involved
> This is an unexpected "gotcha" - some terminal programs
> do NOT color tab characters at all!
I am curious if such a situation should become better known.
> they just move the cursor,
Indentation is performed then at least.
> while others print multiple spaces which are colored.
This would be nice if you could actually see a different colour.
> You might see different results on your terminal
This can happen because of variations in involved programming interfaces
and supported display capabilities.
> - which means "grep" is not the problem at all here.
There are additional constraints to consider.
> You asked about replacing non-printable characters.
> This is easy enough to do with existing programs,
Do you know any approach which provides a complete replacement
for an usable visual representation already?
> so not likely to be added as a new option to grep.
The match colouring evolved. So I imagine that a corresponding
character replacement could be performed by a companion tool
(similar to your command examples).
> Hope this helps,
I am also curious on how the application knowledge will evolve
further for regular expressions in recent software versions.
Patch code filtering might become safer and easier.