From 7438a2bf19c10f18f112698435e8f962835795f9 Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sun, 9 Oct 2011 00:55:42 +0200 Subject: [PATCH] Improve the rendering of the control characters greatly by using the Unicode counterparts in th 0x24## plane and add a little bit of explanation what we are doing there and why we are doing this. --- src/IDF/Diff.php | 10 +++++++++- www/media/idf/css/style.css | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index d07a7ca..910124a 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -247,8 +247,16 @@ class IDF_Diff private static function makeNonPrintableCharsVisible($line) { + // This translates most of the C0 ASCII control characters into + // their visual counterparts in the 0x24## unicode plane + // (http://en.wikipedia.org/wiki/C0_and_C1_control_codes). + // We could add DEL (0x7F) to this set, but unfortunately this + // is not nicely mapped to 0x247F in the control plane, but 0x2421 + // and adding an if expression below just for this is a little bit + // of a hassle. And of course, the more esoteric ones from C1 are + // missing as well... return preg_replace('/([\x00-\x1F])/ue', - '"".bin2hex("\\1").""', + '"$".bin2hex("\\1").""', $line); } diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index c7a90c6..f319922 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -663,8 +663,6 @@ table.diff-contents td > span.non-printable { color: white; text-transform: uppercase; float: none; - font-size: 5.5pt; - font-family: Calibri, Helvetica, Arial, sans-serif; text-align: center; display: inline-block; padding: 1px 1px 0px 1px;