[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-grep] [bug #11022] Line wrapping causes GREP_COLOR background color

From: Charles Levert
Subject: [bug-grep] [bug #11022] Line wrapping causes GREP_COLOR background color to "smear"
Date: Thu, 28 Apr 2005 16:12:26 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3


                 Summary: Line wrapping causes GREP_COLOR background color to
                 Project: grep
            Submitted by: twaugh
            Submitted on: Tue 11/16/2004 at 13:50
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: Confirmed
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open



Original bug report:

Steps to Reproduce:
1. Open bash in an xterm
2. export GREP_COLOR='1;37;41'
3. export GREP_OPTIONS='--color=auto'
4. press <ENTER> until prompt is on the last line of the xterm
5. grep 'expressions containing' /usr/share/doc/grep-2.5.1/*

The red background colour extends to the end of the line.

Suggested patch attached.


Follow-up Comments:

Date: Thu 04/28/2005 at 16:10       By: Charles Levert <charles_levert>
Here's a new patch, produced by cannibalizing patch #3644.  The framework
introduced by the preprocessor macros is a good thing to have now as moves
the actual SGR strings in one place and it will be re-used many times by a
newer patch #3644.

This includes a corresponding update to tests/foad1.sh as well.

Only the ChangeLog entry is missing and will be added upon commit.

Ok to commit?

Date: Sat 01/15/2005 at 23:24       By: Charles Levert <charles_levert>

This is now completely covered by patch #3644 which
obsoletes the patch in this bug report.

Date: Sat 01/15/2005 at 14:34       By: Charles Levert <charles_levert>

I am afraid the proposed solution isn't enough to cover
all cases.  Tab characters (HT) have the effect of moving
the position without writing spaces in between (as if the
pen or printing head was lifted during the move).

If matches are denoted by <...>, consider this:


The HT is likely to appear with the background color
of matches when the conditions for running grep are as
you described.  Yet, your patch only clears to the end of
line at the very end.

A thorough, if expensive, solution would be to replace
all occurences of "\33[m" (or the wasteful "\33[00m")
by "\33[m\33[K", possibly by defining a preprocessor
macro for it (e.g., SGR_END).

Also, your patch does not seem to cover the match_icase
code path.

Date: Tue 11/16/2004 at 16:56       By: Tim Waugh <twaugh>
Oops, here is a fixed patch.


File Attachments:

Date: Thu 04/28/2005 at 16:10  Name: charles1a.patch  Size: 2.81KB   By:
Complete fix to all SGR_END strings + SGR framework
Date: Tue 11/16/2004 at 16:56  Name: grep-2.5.1-color.patch  Size: 313B   By:
Date: Tue 11/16/2004 at 13:50  Name: grep-2.5.1-color.patch  Size: 322B   By:


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]