[chora] small bug

Mathieu Arnold arn_mat@club-internet.fr
Wed, 28 Feb 2001 12:02:48 +0100



Mathieu Arnold wrote:
> 
> Anil Madhavapeddy wrote:
> >
> > Quoting Mathieu Arnold <arn_mat@club-internet.fr>:
> >
> > > > i just got a cvs snapshot of chora, and there's the file
> > > > templates/hr_diff_empty.inc that's been deleted but it's still used in
> > > > diff.php line 119...
> >
> > I forgot to cvs add that; just checked it in again.
> >
> > >
> > > would render the diffs a bit better.
> > >
> >
> > I committed something similar, thanks for the patch - keep them coming ;-)
> 
> what you committed was a bit wrong ;)
> you were replacing 2 spaces by a single &nbsp; which is wrong, we cannot
> put 2 &nbsp; because the line could became unbreakable, which is wrong
> too, so, just do as it's done in cvsweb.cgi, and do that :

forgive me, here is what it should look like :)

Index: diff.php
===================================================================
RCS file: /home/cvs/cvs/dup/horde/chora/diff.php,v
retrieving revision 1.23
diff -u -r1.23 diff.php
--- diff.php    2001/02/28 00:59:10     1.23
+++ diff.php    2001/02/28 11:02:08
@@ -17,7 +17,7 @@
 function htmlspaces($text) {
     $text = htmlspecialchars($text);
     $text = str_replace("\t", '        ', $text);
-    return str_replace('  ', '&nbsp;', $text);
+    return str_replace('  ', '&nbsp; ', $text);
 }
 
 require_once dirname(__FILE__).'/common.php';
@@ -125,7 +125,7 @@
                   }
                   break;
               case CVSLIB_DIFF_EMPTY:
-                  $line = htmlspecialchars($change['line']);
+                  $line = htmlspaces($change['line']);
                   if (empty($line)) $line = '&nbsp;';
                  
include($conf['paths']['templates'].'/hr_diff_empty.inc');
                   break;

-- 
Mathieu Arnold