Subject: bug#15444: One character can be lost if colors are enabled

From: Vincent Lefevre <[email-masked]>
Date: Wed, 27 Mar 2024 00:50:05 +0100

On 2024-03-26 11:47:26 -0600, Paul Eggert wrote:
> On 3/25/24 08:49, Vincent Lefevre wrote:
> > This works fine in Xterm, giving on a 80-column terminal:
> > 
> > ...
> > However, this triggers the bug in GNOME Terminal (and other
> > libvte-based terminals):
> 
> That's not good. Is there some escape sequence that will work on
> both xterm and libvte? I assume the space+backspace trick you
> suggested later assumes xterm behavior.

I've eventually found that this works in xterm only because
I have the reverseWrap option set (a setting I've had since
at least June 1996... so that I forgot about it). In the past,
I think that I set it in order to be able to go backward to
the previous line in cooked mode. But this is not the default
behavior in xterm (at least nowadays).

It could still be nice to have this trick in grep as an *option*
for GREP_COLORS (just like one already has "ne").

But perhaps the best solution would be to make terminals implement
new escape sequences to enable/disable the use of the default
background color (instead of the current background color, which
is the current behavior and the cause of this bug) for the new line
when scrolling, or something similar.

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)