bug-grep
[Top][All Lists]
Advanced

[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

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11022>

                 Summary: Line wrapping causes GREP_COLOR background color to
"smear"
                 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

    _______________________________________________________

Details:

Original bug report:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=138913

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:

.............<..
..>...HT........
.........<..>.

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:
charles_levert
Complete fix to all SGR_END strings + SGR framework
<http://savannah.gnu.org/bugs/download.php?item_id=11022&item_file_id=2449>
-------------------------------------------------------
Date: Tue 11/16/2004 at 16:56  Name: grep-2.5.1-color.patch  Size: 313B   By:
twaugh
grep-2.5.1-color.patch
<http://savannah.gnu.org/bugs/download.php?item_id=11022&item_file_id=1883>
-------------------------------------------------------
Date: Tue 11/16/2004 at 13:50  Name: grep-2.5.1-color.patch  Size: 322B   By:
twaugh
grep-2.5.1-color.patch
<http://savannah.gnu.org/bugs/download.php?item_id=11022&item_file_id=1882>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11022>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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