From 80d2d9d294bbbc20c27cbe2f8f604854e9c4a045 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 22 May 2009 18:54:24 +0000 Subject: - improve pmore movie syntax highlight git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4458 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'mbbsd/edit.c') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index a94190ff..89a1e729 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -2278,6 +2278,7 @@ void syn_pmore_render(char *os, int len, char *buf) char *s = (char *)mf_movieFrameHeader((unsigned char*)os, (unsigned char*)os + len); char attr = 1; char iname = 0; + char prefix = 0; memset(buf, 0, len); if (!len || !s) return; @@ -2334,23 +2335,26 @@ void syn_pmore_render(char *os, int len, char *buf) attr++; continue; + case 'I': case 'G': iname = 0; *buf++ = attr++; - while (len >0 && + prefix = 1; + while (len > 0 && ( (isascii(*s) && isalnum(*s)) || strchr("+-:lpf,", *s)) ) { - if (*s == ':') + if (prefix) { - if (++iname % 2) - attr ++; + if (!strchr(":lpf", *s)) + break; + prefix = 0; } *buf++ = attr; - if (*s == ',') attr++; - if (*s == ':' && !(iname%2) ) + if (*s == ',') { - attr--; + attr++; + prefix = 1; } s++; len--; } -- cgit v1.2.3