Skip to content
Snippets Groups Projects
Commit 07a8e691 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

better whitespace preserve fix in diffs

Ignore-this: ce1092e86cbb4911e285377233b89aa0

darcs-hash:20091119085441-6e07b-79f74d6349df87625aaaba919664879fcc440244.gz
parent c0322273
No related branches found
No related tags found
No related merge requests found
......@@ -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>';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment