diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php
index ca5f25f..9a078e6 100644
--- a/src/IDF/Diff.php
+++ b/src/IDF/Diff.php
@@ -113,7 +113,8 @@ class IDF_Diff
} else {
$class = 'diff-a';
}
- $out .= sprintf('
%s | %s | %s |
'."\n", $line[0], $line[1], $class, Pluf_esc($line[2]));
+ $line_content = $this->padLine(Pluf_esc($line[2]));
+ $out .= sprintf('%s | %s | %s |
'."\n", $line[0], $line[1], $class, $line_content);
}
if (count($file['chunks']) > $cc)
$out .= '... | ... | |
'."\n";
@@ -124,6 +125,18 @@ class IDF_Diff
return $out;
}
+
+ public function padLine($line)
+ {
+ $n = strlen($line);
+ for ($i=0;$i<$n;$i++) {
+ if (substr($line, $i, 1) != ' ') {
+ break;
+ }
+ }
+ return str_repeat(' ', $i).substr($line, $i);
+ }
+
/**
* @return array array(array(start, n), array(start, n))
*/