[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31071: Previous color lost when using --color=always option
From: |
Adrian H |
Subject: |
bug#31071: 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#31071: Previous color lost when using --color=always option,
Adrian H <=