diff options
Diffstat (limited to 'mbbsd/pmore.c')
-rw-r--r-- | mbbsd/pmore.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index 2412eb39..3816a82b 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -134,8 +134,6 @@ int debug = 0; // --------------------------- <Display> /* ANSI COMMAND SYSTEM */ -#define STR_ANSICODE "[0123456789;," - /* On some systems with pmore style ANSI system applied, * we don't have to define these again. */ @@ -153,6 +151,9 @@ int debug = 0; #define ANSI_MOVETO(y,x) ESC_STR "[" #y ";" #x "H" #define ANSI_CLRTOEND ESC_STR "[K" +#define ANSI_IN_ESCAPE(x) (((x) >= '0' && (x) <= '9') || \ + (x) == ';' || (x) == ',' || (x) == '[') + #endif /* PMORE_STYLE_ANSI */ // Poor BBS terminal system Workarounds @@ -679,7 +680,8 @@ pmore_str_strip_ansi(unsigned char *p) // warning: p is NULL terminated { // ansi code sequence, ignore them. pb = p++; - while (*p && strchr(STR_ANSICODE, *p++)); + while (ANSI_IN_ESCAPE(*p)) + p++; memmove(pb, p, strlen(p)+1); p = pb; } @@ -855,7 +857,7 @@ MFDISP_PREDICT_LINEWIDTH(unsigned char *p) { if(inAnsi) { - if(!strchr(STR_ANSICODE, *p)) + if(!ANSI_IN_ESCAPE(*p)) inAnsi = 0; } else { if(*p == ESC_CHR) @@ -1139,7 +1141,7 @@ mf_display() { if(inAnsi) { - if (!strchr(STR_ANSICODE, c)) + if (!ANSI_IN_ESCAPE(c)) inAnsi = 0; /* whatever this is, output! */ mf.dispe ++; |