[chora] small bug

Mathieu Arnold arn_mat@club-internet.fr
Thu, 01 Mar 2001 02:59:53 +0100



Mathieu Arnold wrote:
> 
> Anil Madhavapeddy wrote:
> >
> > On Thu, Mar 01, 2001 at 02:08:00AM +0100, Mathieu Arnold wrote:
> > >
> > > it's getting better all the time :)
> > > just one thing, say, i have 3 spaces somewhere in a line that are used
> > > to make it render better, well, with this code, it would result in :
> > > "   ", so, we could do a :
> >
> > Yup, good point - applied.
> 
> btw, there were really 2 str_replace in my patch, and they were really
> both useful :)
> the one you left is worst than it was before :)

and after a bit of though,
diff -u -r1.25 diff.php
--- diff.php    2001/03/01 01:26:29     1.25
+++ diff.php    2001/03/01 01:58:15
@@ -17,7 +17,8 @@
   */
 function htmlspaces($text='') {
     $text = htmlspecialchars($text);
-    $text = str_replace("\t", '        ', $text);
+    $text = str_replace("\t", '        ', $text);
+    $text = str_replace('  ', '  ', $text);
     $text = str_replace('  ', '  ', $text);
     return empty($text)?' ':$text;
 }

should be good :)

-- 
Mathieu Arnold / going to bed now