fixed a bug of not showing whitespaces at the end of different lines in the full diff view

This commit is contained in:
hyung-hwan 2015-01-30 06:13:15 +00:00
parent db114f4aa4
commit cac4433101
2 changed files with 8 additions and 8 deletions

View File

@ -327,8 +327,7 @@ class SubversionModel extends Model
if ($curoline < $oline) if ($curoline < $oline)
{ {
$nl = fgets($ofile); $nl = fgets($ofile);
$line = rtrim($nl, "\r\n");
$line = rtrim($nl);
if ($ent) $line = replaceEntities($line, $rep); if ($ent) $line = replaceEntities($line, $rep);
//$listing[$index]["rev1line"] = hardspace($line); //$listing[$index]["rev1line"] = hardspace($line);
@ -346,7 +345,7 @@ class SubversionModel extends Model
{ {
$nl = fgets($nfile); $nl = fgets($nfile);
$line = rtrim($nl); $line = rtrim($nl, "\r\n");
if ($ent) $line = replaceEntities($line, $rep); if ($ent) $line = replaceEntities($line, $rep);
//$listing[$index]["rev2line"] = hardspace($line); //$listing[$index]["rev2line"] = hardspace($line);
@ -388,7 +387,7 @@ class SubversionModel extends Model
$mod = $line{0}; $mod = $line{0};
$line = rtrim(substr($line, 1)); $line = rtrim(substr($line, 1), "\r\n");
if ($ent) $line = replaceEntities($line, $rep); if ($ent) $line = replaceEntities($line, $rep);
//if (strip_tags($line) == '') $line = '&nbsp;'; //if (strip_tags($line) == '') $line = '&nbsp;';
@ -501,7 +500,7 @@ class SubversionModel extends Model
if (!feof($ofile)) if (!feof($ofile))
{ {
$line = rtrim(fgets($ofile)); $line = rtrim(fgets($ofile), "\r\n");
if ($ent) $line = replaceEntities($line, $rep); if ($ent) $line = replaceEntities($line, $rep);
} }
@ -517,8 +516,8 @@ class SubversionModel extends Model
if (!feof($nfile)) if (!feof($nfile))
{ {
$line = rtrim(fgets($nfile)); $line = rtrim(fgets($nfile), "\r\n");
if ($ent) $line = replaceEntities(rtrim(fgets($nfile)), $rep); if ($ent) $line = replaceEntities(rtrim(fgets($nfile), "\r\n"), $rep);
} }
if (!feof($nfile)) { if (!feof($nfile)) {

View File

@ -136,7 +136,6 @@ function format_diff ($a, $b, $css_class)
if ($b == '') return htmlspecialchars($a); if ($b == '') return htmlspecialchars($a);
// TODO: word by word comparison to be less position dependent // TODO: word by word comparison to be less position dependent
$cc = ''; $cc = '';
$diffstart = -1; $diffstart = -1;
$alen = strlen($a); $alen = strlen($a);
@ -171,7 +170,9 @@ function format_diff ($a, $b, $css_class)
{ {
if ($alen > $blen) if ($alen > $blen)
{ {
$cc .= sprintf ('<span class="%s">', $css_class);
$cc .= htmlspecialchars(substr ($a, $blen, $alen - $blen)); $cc .= htmlspecialchars(substr ($a, $blen, $alen - $blen));
$cc .= '</span>';
} }
} }