[Top][All Lists]

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

diff -y doesn't recognize some color control sequences

From: Ismael Barros²
Subject: diff -y doesn't recognize some color control sequences
Date: Thu, 17 Sep 2009 10:41:55 +0200

version: diff (GNU diffutils) 2.8.1

Diff doesn't seem to recognize color sequences like "^[[33m", where
the first ^[, which is the character 27, is the only one recognized as
non printable.
These control sequences are printed properly, but the output is not
aligned, as some non-printable characters are counted as printable

I'm attaching a patch and two screenshots, one before the patch, and
one after the patch. The patch is quite nasty code, but it may give
you an idea on how to fix the problem. It contains two versions: the
first one seems cleaner but for some reason isn't completely working
for me right now, and the second one works but is dirtier, specially
because I'm not checking string boundaries. There's also no check for
color capabilities in the terminal.

The colored output has been produced with "code2color -l c", and also
with "grcat" in other tests I've done.


Attachment: color.patch
Description: Text Data

Attachment: diffbug.png
Description: PNG image

Attachment: diffbug_patched.png
Description: PNG image

reply via email to

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