cvs: ZendEngine2 / zend_highlight.c

From: Date: Sun, 12 May 2002 15:59:29 +0000
Subject: cvs: ZendEngine2 / zend_highlight.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-121@lists.php.net to get a copy of this message
zeev Sun May 12 11:59:29 2002 EDT Modified files: /ZendEngine2 zend_highlight.c Log: MFZE1 Index: ZendEngine2/zend_highlight.c diff -u ZendEngine2/zend_highlight.c:1.28 ZendEngine2/zend_highlight.c:1.29 --- ZendEngine2/zend_highlight.c:1.28 Sat May 11 08:36:32 2002 +++ ZendEngine2/zend_highlight.c Sun May 12 11:59:29 2002 @@ -58,16 +58,21 @@ const char *ptr=s, *end=s+len; while (ptr<end) { - if (*ptr==' ' - && len>1 - && !(((ptr+1)>=end) || (*(ptr+1)==' ')) /* next is not a space */ - && !((ptr==s) || (*(ptr-1)==' '))) /* last is not a space */ { - char c = *ptr++; - - ZEND_PUTC(c); - continue; + if (*ptr==' ') { + /* Series of spaces should be displayed as &nbsp;'s + * whereas single spaces should be displayed as a space + */ + if ((ptr+1) < end && *(ptr+1)==' ') { + do { + zend_html_putc(*ptr); + } while ((++ptr < end) && (*ptr==' ')); + } else { + ZEND_PUTC(*ptr); + ptr++; + } + } else { + zend_html_putc(*ptr++); } - zend_html_putc(*ptr++); } }

« previous php.zend-engine.cvs (#121) next »