GNU bug report logs - #31071
Previous color lost when using --color=always option

Previous Next

Package: grep;

Reported by: Adrian H <adrianh.bsc <at> gmail.com>

Date: Thu, 5 Apr 2018 21:32:01 UTC

Severity: wishlist

To reply to this bug, email your comments to 31071 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#31071; Package grep. (Thu, 05 Apr 2018 21:32:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Adrian H <adrianh.bsc <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Thu, 05 Apr 2018 21:32:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Adrian H <adrianh.bsc <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Previous color lost when using --color=always option
Date: Thu, 5 Apr 2018 12:44:29 -0400
If I use grep --color=always and it matches on a line that is already
coloured, it results in the text after the match is reset to the
terminal's default colour/attributes.  E.g.

This just shows a line with some colour/attributes set:

  $ echo The quick brown fox jumps over the lazy dog |
  > GREP_COLOR='03;36' grep --color=always '.*'
  ESC[03;36mESC[KThe quick brown fox jumps over the lazy dogESC[mESC[K

This shows the same line with fox highlighted in other attributes:

  $ echo The quick brown fox jumps over the lazy dog |
  >  GREP_COLOR='03;36' grep --color=always '.*' |
  >  GREP_COLOR='01;36' grep --color=always 'fox'
  ESC[03;36mESC[KThe quick brown ESC[01;36mESC[KfoxESC[mESC[K jumps
over the lazy dogESC[mESC[K

The issue is that the current colour isn't tracked, it is just reset
with ESC[m.  It would be nice if it were able to be tracked.  Yes, it
is more difficult to code, but I think it would be useful when
highlighting a coloured textual document.




Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 01 Jan 2020 07:38:02 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.