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

From: Jaroslav Skarvada <[email-masked]>
Date: Mon, 23 Sep 2013 09:34:05 -0400 (EDT)

Reproducer:
$ printf 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1234xxxxxxxxx\n' | grep 1234 --color=always
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx123xxxxxxxxx

This can be reproduced at least on xterm and linux console,
but it works on xfce4-terminal and konsole (at least).

The EL command (\E[K) is sent to clear the line. The VT100
terminal autowraps when the 81th character is received and the
EL command is not counted as a character. So if 80 characters
are received, it waits on the 80th character and the following
EL command erases characters from the current one to the end
of line (i.e. the last character on the line).

Workaround is to use GREP_COLORS=ne.

The original Red Hat bugzilla that contains discussion with
the xterm upstream:

http://bugzilla.redhat.com/show_bug.cgi?id=1006310