Fix issue 748.
This commit is contained in:
parent
ae11b1de4a
commit
d2db3b16d2
@ -182,17 +182,29 @@ class IDF_Diff
|
|||||||
list($added, $removed) = end($file['chunks_def']);
|
list($added, $removed) = end($file['chunks_def']);
|
||||||
|
|
||||||
$added = $added[0] + $added[1];
|
$added = $added[0] + $added[1];
|
||||||
$leftwidth = 1;
|
$leftwidth = 0;
|
||||||
if ($added > 0)
|
if ($added > 0)
|
||||||
$leftwidth = ((ceil(log10($added)) + 1) * 8) + 12;
|
$leftwidth = ((ceil(log10($added)) + 1) * 8) + 12;
|
||||||
|
|
||||||
$removed = $removed[0] + $removed[1];
|
$removed = $removed[0] + $removed[1];
|
||||||
$rightwidth = 1;
|
$rightwidth = 0;
|
||||||
if ($removed > 0)
|
if ($removed > 0)
|
||||||
$rightwidth = ((ceil(log10($removed)) + 1) * 8) + 12;
|
$rightwidth = ((ceil(log10($removed)) + 1) * 8) + 12;
|
||||||
|
|
||||||
|
// we need to correct the width of a single column a little
|
||||||
|
// to take less space and to hide the empty one
|
||||||
|
$class = '';
|
||||||
|
if ($leftwidth == 0) {
|
||||||
|
$class = 'left-hidden';
|
||||||
|
$rightwidth -= floor(log10($removed));
|
||||||
|
}
|
||||||
|
else if ($rightwidth == 0) {
|
||||||
|
$class = 'right-hidden';
|
||||||
|
$leftwidth -= floor(log10($added));
|
||||||
|
}
|
||||||
|
|
||||||
$inner_linecounts =
|
$inner_linecounts =
|
||||||
'<table class="diff-linecounts">' ."\n".
|
'<table class="diff-linecounts '.$class.'">' ."\n".
|
||||||
'<colgroup><col width="'.$leftwidth.'" /><col width="'. $rightwidth.'" /></colgroup>' ."\n".
|
'<colgroup><col width="'.$leftwidth.'" /><col width="'. $rightwidth.'" /></colgroup>' ."\n".
|
||||||
'<tr class="line">' .
|
'<tr class="line">' .
|
||||||
implode('</tr>'."\n".'<tr class="line">', $offsets).
|
implode('</tr>'."\n".'<tr class="line">', $offsets).
|
||||||
|
@ -666,6 +666,11 @@ table.diff-linecounts td {
|
|||||||
border-left: 1px solid #d3d7cf;
|
border-left: 1px solid #d3d7cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.diff-linecounts.left-hidden tr > td:first-child,
|
||||||
|
table.diff-linecounts.right-hidden tr > td + td {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
table.diff-contents td {
|
table.diff-contents td {
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
|
Loading…
Reference in New Issue
Block a user