summaryrefslogtreecommitdiff
path: root/inc/DifferenceEngine.php
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2009-11-19 09:54:41 +0100
committerAndreas Gohr <gohr@cosmocode.de>2009-11-19 09:54:41 +0100
commit07a8e691a67d5a3867cc267b6c281784748c1055 (patch)
tree1dd0df0a5f080d454792ff6bf3d2846679945eb1 /inc/DifferenceEngine.php
parentc0322273adef5540c5e780c7a82329b5862a0871 (diff)
downloadrpg-07a8e691a67d5a3867cc267b6c281784748c1055.tar.gz
rpg-07a8e691a67d5a3867cc267b6c281784748c1055.tar.bz2
better whitespace preserve fix in diffs
Ignore-this: ce1092e86cbb4911e285377233b89aa0 darcs-hash:20091119085441-6e07b-79f74d6349df87625aaaba919664879fcc440244.gz
Diffstat (limited to 'inc/DifferenceEngine.php')
-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(' ','&nbsp;',$text);
+ $text = str_replace(' ',' &nbsp;',$text);
+ if($text{0} == ' ') $text = '&nbsp;'.substr($text,1);
return $text;
}
@@ -1002,13 +1003,15 @@ class TableDiffFormatter extends DiffFormatter
}
function addedLine( $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-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>';
}