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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Severity: wishlist; Reported by: Adrian H <adrianh.bsc@HIDDEN>; dated Thu, 5 Apr 2018 21:32:01 UTC; Maintainer for grep is bug-grep@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Apr 2018 21:31:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 05 17:31:23 2018
Received: from localhost ([127.0.0.1]:39698 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1f4CTb-0005Op-KW
	for submit <at> debbugs.gnu.org; Thu, 05 Apr 2018 17:31:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35588)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adrian.hawryluk@HIDDEN>) id 1f4807-0007Kx-NG
 for submit <at> debbugs.gnu.org; Thu, 05 Apr 2018 12:44:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <adrian.hawryluk@HIDDEN>) id 1f4801-0005pv-LE
 for submit <at> debbugs.gnu.org; Thu, 05 Apr 2018 12:44:34 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38038)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <adrian.hawryluk@HIDDEN>)
 id 1f4801-0005pp-I7
 for submit <at> debbugs.gnu.org; Thu, 05 Apr 2018 12:44:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54790)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <adrian.hawryluk@HIDDEN>) id 1f4800-00054T-Jf
 for bug-grep@HIDDEN; Thu, 05 Apr 2018 12:44:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <adrian.hawryluk@HIDDEN>) id 1f47zz-0005pA-Nx
 for bug-grep@HIDDEN; Thu, 05 Apr 2018 12:44:32 -0400
Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:44836)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <adrian.hawryluk@HIDDEN>)
 id 1f47zz-0005ot-HS
 for bug-grep@HIDDEN; Thu, 05 Apr 2018 12:44:31 -0400
Received: by mail-wr0-x232.google.com with SMTP id u46so29522901wrc.11
 for <bug-grep@HIDDEN>; Thu, 05 Apr 2018 09:44:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:sender:from:date:message-id:subject:to;
 bh=Nx+S48n6tFY9pcD9W8tIlJ+z7sS3aTJe8amw3EwxQts=;
 b=fucg8RkvCK2a+C8qEZoo0pO7OIWUdo9q+HSZSO7nSq0oVMXP2VL/Llcb/9FCANnhlo
 7dw5M7HifoMMcmYs1Ww/rpct2SMYU21vlDTdESDTcNHJFLEoz0HgEI0MNfcmPSTyrftu
 nH7MxvW6vB3Sx7bTH17cozIhF+7cQUxH6QZb6Jj2LEOAMdSTOrESMJU+GAPlDeIGmrYR
 1ss1oINPu4iANZTWh+MpeGREsrKV+8oGA9tJGdTHsB5s0gvFiBe8Z2gpdjWXoZKTY1rS
 HQg9sR50dO2exu4+oLiZea8xSxtJ9B0LFftkxN4FTwb4f1YaFMBdayVa9DRFoOZ7iRQo
 4soQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:sender:from:date:message-id:subject
 :to; bh=Nx+S48n6tFY9pcD9W8tIlJ+z7sS3aTJe8amw3EwxQts=;
 b=Y87km/lwKoJalXi1IsRORlaGnO4NdusBuimvISdULwIJb3icCrEUBiCHrCZtUqigM+
 UaB42MCHbQbq55EQhieGNkuv56YrfmtNus7pd6L2iyktaimmd4Pe9SjraMjKQTkTit2p
 +3BYs+9bjLFVyOeVIMOOtdqnybBEwdncKAz8bte04kRhtyMdYw07cyuqhBYD8ZkayyD0
 vcy9GQsPmLWcSzB9L8lCQYQioOMGwgEtFu8PhNIPz5iQqv2h+8zLvvMpEWI27+kCi+9x
 WXeo+Uvg90hqddmgVisotBllbZSrbe6S1+reLD55+kx7mxP2U+0kTV95jO+FArpZQeca
 rINQ==
X-Gm-Message-State: ALQs6tD0IGUYLJMAYW3gRhnfRx4AhirbBc7SUBMPw936A81BveSI1rj0
 D+RTK9rc3JniwHJHCg8QND4bjZft3Cu63HhVCdtUhw==
X-Google-Smtp-Source: AIpwx4+5HSys7eOTpdn0RWN/uIBcFCfWVj53x5CjKLdSq3Ut36YocXl7hgX+ptTitRnhf1Uvzr8jO+1Kpq5Br7AF3uI=
X-Received: by 2002:a19:c1c8:: with SMTP id
 r191-v6mr13360896lff.45.1522946669760; 
 Thu, 05 Apr 2018 09:44:29 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.179.88.133 with HTTP; Thu, 5 Apr 2018 09:44:29 -0700 (PDT)
From: Adrian H <adrianh.bsc@HIDDEN>
Date: Thu, 5 Apr 2018 12:44:29 -0400
X-Google-Sender-Auth: 4dJyPfNyLD7wlqFCTSiw54TcEkc
Message-ID: <CAP_kE8V9A1Oj9B=1UnKQTU6j44XG8L=WrToy6iZniA-Q2Hc+sw@HIDDEN>
Subject: Previous color lost when using --color=always option
To: bug-grep@HIDDEN
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 05 Apr 2018 17:31:22 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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.




Acknowledgement sent to Adrian H <adrianh.bsc@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#31071; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 1 Jan 2020 07:45:02 UTC

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