From d2db3b16d2c15d6b9b40f27dda02e6c0e6e13a7d Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Thu, 27 Oct 2011 23:32:18 +0200 Subject: [PATCH] Fix issue 748. --- src/IDF/Diff.php | 18 +++++++++++++++--- www/media/idf/css/style.css | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index 798b0a8..6c76ce2 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -182,17 +182,29 @@ class IDF_Diff list($added, $removed) = end($file['chunks_def']); $added = $added[0] + $added[1]; - $leftwidth = 1; + $leftwidth = 0; if ($added > 0) $leftwidth = ((ceil(log10($added)) + 1) * 8) + 12; $removed = $removed[0] + $removed[1]; - $rightwidth = 1; + $rightwidth = 0; if ($removed > 0) $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 = - '' ."\n". + '
' ."\n". '' ."\n". '' . implode(''."\n".'', $offsets). diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index 325cc24..e6dae6f 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -666,6 +666,11 @@ table.diff-linecounts td { 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 { line-height: 12px; padding: 2px;