summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/DifferenceEngine.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php
index 165ddddbc..e28826c1f 100644
--- a/inc/DifferenceEngine.php
+++ b/inc/DifferenceEngine.php
@@ -978,7 +978,8 @@ class TableDiffFormatter extends DiffFormatter
function _pre($text){
$text = htmlspecialchars($text);
- $text = str_replace(' ',' ',$text);
+ $text = str_replace(' ','  ',$text);
+ if($text{0} == ' ') $text = ' '.substr($text,1);
return $text;
}
@@ -1002,13 +1003,15 @@ class TableDiffFormatter extends DiffFormatter
}
function addedLine( $line ) {
- $line = str_replace(' ',' ',$line);
+ $line = str_replace(' ','  ',$line);
+ if($line{0} == ' ') $line = ' '.substr($line,1);
return '<td>+</td><td class="diff-addedline">' .
$line.'</td>';
}
function deletedLine( $line ) {
- $line = str_replace(' ','&nbsp;',$line);
+ $line = str_replace(' ',' &nbsp;',$line);
+ if($line{0} == ' ') $line = '&nbsp;'.substr($line,1);
return '<td>-</td><td class="diff-deletedline">' .
$line.'</td>';
}
@@ -1019,7 +1022,8 @@ class TableDiffFormatter extends DiffFormatter
}
function contextLine( $line ) {
- $line = str_replace(' ','&nbsp;',$line);
+ $line = str_replace(' ',' &nbsp;',$line);
+ if($line{0} == ' ') $line = '&nbsp;'.substr($line,1);
return '<td> </td><td class="diff-context">'.$line.'</td>';
}