buggrep - Bugs: bug #11022, Line wrapping causes GREP_COLOR...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #11022: Line wrapping causes GREP_COLOR background color to "smear"

Submitted by:  Tim Waugh <twaugh>
Submitted on:  Tue 16 Nov 2004 01:50:19 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

(Jump to the original submission Jump to the original submission)

Tue 14 Jun 2005 09:03:30 PM UTC, comment #8:

Attached file #2606 (charles1b.patch) applied (commmited) to CVS.

Charles Levert <charles_levert>
Thu 28 Apr 2005 07:04:54 PM UTC, comment #7:

The "do { ... } while (0)" makes it the syntactical equivalent of a function call. Consider

#define F(x) if (x) h(x)
#define G(x) do { if (x) h(x); } while (0)

{
if (y)
F(x);
else
z++;

if (y)
G(x);
else
z++;
}

and match the "else" statements to their corresponding "if". (Code indentation will probably be lost on the Savannah web page.)

The construct will otherwise usually be removed by the optimizer.

Charles Levert <charles_levert>
Thu 28 Apr 2005 06:03:44 PM UTC, comment #6:

Is it a standard practice to use "do { ... } while (0)" in macro definitions? I haven't seen this practice before.

Tony Abou-Assaleh <taa>
Project Administrator
Thu 28 Apr 2005 06:00:34 PM UTC, comment #5:

=====
Depends on the following items
patch #3801 : Red Hat's "color" patch [None]

Items that depend on this one
patch #3801 : Red Hat's "color" patch [None]
=====

I see a dependency loop in the above description

Tony Abou-Assaleh <taa>
Project Administrator
Thu 28 Apr 2005 04:10:24 PM UTC, comment #4:

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?

Charles Levert <charles_levert>
Sat 15 Jan 2005 11:24:48 PM UTC, comment #3:

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

Charles Levert <charles_levert>
Sat 15 Jan 2005 02:34:44 PM UTC, comment #2:

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.

Charles Levert <charles_levert>
Tue 16 Nov 2004 04:56:39 PM UTC, comment #1:

Oops, here is a fixed patch.

Tim Waugh <twaugh>
Tue 16 Nov 2004 01:50:19 PM UTC, original submission:

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.

Tim Waugh <twaugh>

 

Attached Files
file #3088:  charles1b.patch added by charles_levert (5kB - text/x-patch - Newer version with ChangeLog and SGR_START fix)
file #2898:  charles1a.patch added by charles_levert (3kB - text/x-patch - Complete fix to all SGR_END strings + SGR framework)
file #2021:  grep-2.5.1-color.patch added by twaugh (313B - text/x-patch - grep-2.5.1-color.patch)
file #2020:  grep-2.5.1-color.patch added by twaugh (322B - text/x-patch - grep-2.5.1-color.patch)

 

Depends on the following items: None found

Digest:
   patch dependencies.

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 14 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Tue 14 Jun 2005 09:03:30 PM UTCcharles_levertStatusConfirmed=>Fixed
  Open/ClosedOpen=>Closed
Tue 14 Jun 2005 02:39:57 PM UTCcharles_levertAttached File-=>Added charles1b.patch, #2606
Mon 13 Jun 2005 08:21:32 PM UTCjulianfoadDependenciesRemoved dependancy to patch #3801=>-
Mon 13 Jun 2005 08:21:18 PM UTCjulianfoadDependenciesRemoved dependancy to patch #3644=>-
Thu 28 Apr 2005 04:20:12 PM UTCcharles_levertSummaryLine wrapping causes GREP_COLOR background color to \\\\\\\\\\\\\\\\=>Line wrapping causes GREP_COLOR background color to "smear"
Thu 28 Apr 2005 04:16:46 PM UTCcharles_levertSummaryLine wrapping causes GREP_COLOR background color to \\\\\\\\=>Line wrapping causes GREP_COLOR background color to \\\\\\\\\\\\\\\\
  Dependencies-=>Depends on patch #3644
Thu 28 Apr 2005 04:15:52 PM UTCcharles_levertSummaryLine wrapping causes GREP_COLOR background color to "smear"=>Line wrapping causes GREP_COLOR background color to \\\\\\\\
  Dependencies-=>Depends on patch #3801
Thu 28 Apr 2005 04:11:14 PM UTCcharles_levertStatusNone=>Confirmed
Thu 28 Apr 2005 04:10:24 PM UTCcharles_levertAttached File-=>Added charles1a.patch, #2449
Tue 16 Nov 2004 04:56:39 PM UTCtwaughAttached File-=>Added grep-2.5.1-color.patch, #1883
Tue 16 Nov 2004 01:50:19 PM UTCtwaughAttached File-=>Added grep-2.5.1-color.patch, #1882

Back to the top


Powered by Savane 3.1-cleanup