cvs: Zend / zend_highlight.c
| From: | Zeev Suraski | Date: | Sun, 12 May 2002 15:59:13 +0000 |
| Subject: | cvs: Zend / zend_highlight.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-120@lists.php.net to get a copy of this message | ||
zeev Sun May 12 11:59:13 2002 EDT
Modified files:
/Zend zend_highlight.c
Log:
Improve html_puts()
Index: Zend/zend_highlight.c
diff -u Zend/zend_highlight.c:1.28 Zend/zend_highlight.c:1.29
--- Zend/zend_highlight.c:1.28 Sat May 11 08:35:52 2002
+++ Zend/zend_highlight.c Sun May 12 11:59:13 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 '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++);
}
}