From 7d044e2a0700980fc1947982c674b56c359b35ae Mon Sep 17 00:00:00 2001
From: Adrian Lang <lang@cosmocode.de>
Date: Mon, 9 Nov 2009 13:20:03 +0100
Subject: [PATCH] Preserve all whitespaces in diff

darcs-hash:20091109122003-e4919-c5690b4fc4a3cc1c134f69c137f60155bcdfaa38.gz
---
 inc/DifferenceEngine.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php
index 50bc0b79a..165ddddbc 100644
--- a/inc/DifferenceEngine.php
+++ b/inc/DifferenceEngine.php
@@ -978,7 +978,7 @@ class TableDiffFormatter extends DiffFormatter
 
   function _pre($text){
     $text = htmlspecialchars($text);
-    $text = str_replace('  ',' &nbsp;',$text);
+    $text = str_replace(' ','&nbsp;',$text);
     return $text;
   }
 
@@ -1002,13 +1002,13 @@ class TableDiffFormatter extends DiffFormatter
   }
 
   function addedLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
+    $line = str_replace(' ','&nbsp;',$line);
     return '<td>+</td><td class="diff-addedline">' .
       $line.'</td>';
   }
 
   function deletedLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
+    $line = str_replace(' ','&nbsp;',$line);
     return '<td>-</td><td class="diff-deletedline">' .
       $line.'</td>';
   }
@@ -1019,7 +1019,7 @@ class TableDiffFormatter extends DiffFormatter
   }
 
   function contextLine( $line ) {
-    $line = str_replace('  ','&nbsp; ',$line);
+    $line = str_replace(' ','&nbsp;',$line);
     return '<td> </td><td class="diff-context">'.$line.'</td>';
   }
 
-- 
GitLab