diff options
author | Zeev Suraski <zeev@php.net> | 2002-05-12 15:59:29 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2002-05-12 15:59:29 +0000 |
commit | 2931bb640d183693c11a4439e3eeacdbdf703744 (patch) | |
tree | 50eda4ef667dc46d55bb26d7653a8010e13bd425 /Zend/zend_highlight.c | |
parent | f866bdc368fc2b18b74ce14dc0179a26419a1177 (diff) | |
download | php-git-2931bb640d183693c11a4439e3eeacdbdf703744.tar.gz |
MFZE1
Diffstat (limited to 'Zend/zend_highlight.c')
-rw-r--r-- | Zend/zend_highlight.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index f342e4dad6..1a3c3403f9 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -58,16 +58,21 @@ ZEND_API void zend_html_puts(const char *s, uint len) 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++); } } |