Indefero

Indefero Commit Details


Date:2011-10-05 19:31:36 (13 years 2 months ago)
Author:Thomas Keller
Branch:develop, feature.diff-whitespace, feature.wiki-default-page, release-1.2, release-1.3
Commit:b413b7ee8903d7a8630e7042908937cc5126ac98
Parents: f19f07ec59b307b2f89bd35251dd2837758faec1
Message:Improve the calculation part and reuse the values we have from the diff hunks.

Changes:

File differences

src/IDF/Diff.php
178178
179179
180180
181
182181
183182
184183
......
195194
196195
197196
198
199
200197
201198
202199
......
212209
213210
214211
215
212
213
214
215
216
217
218
219
220
221
222
223
224
216225
217226
218227
219
228
220229
221230
222231
$cc = 1;
$offsets = array();
$contents = array();
$maxlinenum = 0;
foreach ($file['chunks'] as $chunk) {
foreach ($chunk as $line) {
$content = Pluf_esc($content);
$content = self::makeNonPrintableCharsVisible($content);
$contents[] = sprintf('<td class="%s%s mono">%s</td>', $class, $pretty, $content);
$maxlinenum = max($maxlinenum, max($left, $right));
}
if (count($file['chunks']) > $cc) {
$offsets[] = '<td class="next">...</td><td class="next">...</td>';
'</table>' ."\n";
$rows = count($offsets);
$colwidth = (ceil(log10($maxlinenum)) + 1) * 10;
list($added, $removed) = end($file['chunks_def']);
$added = $added[0] + $added[1];
$leftwidth = 1;
if ($added > 0)
$leftwidth = (ceil(log10($added)) + 1) * 10;
$removed = $removed[0] + $removed[1];
$rightwidth = 1;
if ($removed > 0)
$rightwidth = (ceil(log10($removed)) + 1) * 10;
$first = array_shift($offsets);
$out .= '<table class="diff" summary="">' ."\n".
'<colgroup><col width="'.$colwidth.'" /><col width="'.$colwidth.'" /><col width="*" /></colgroup>' ."\n".
'<colgroup><col width="'.$leftwidth.'" /><col width="'.$rightwidth.'" /><col width="*" /></colgroup>' ."\n".
'<tr id="diff-'.md5($filename).'">'.
'<th colspan="3">'.Pluf_esc($filename).'</th>'.
'</tr>' ."\n".

Archive Download the corresponding diff file

Page rendered in 0.08055s using 13 queries.