summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/io.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mbbsd/io.c b/mbbsd/io.c
index d158575c..829386f8 100644
--- a/mbbsd/io.c
+++ b/mbbsd/io.c
@@ -375,7 +375,7 @@ strip_ansi(char *buf, char *str, int mode)
/* 20 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 30 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, /* 0~9 ;= */
/* 40 */ 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, /* ABCDHIJK */
- /* 50 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, /* [ */
+ /* 50 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 60 */ 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 2, 0, 0, /* fhlm */
/* 70 */ 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* su */
/* 80 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -396,18 +396,22 @@ strip_ansi(char *buf, char *str, int mode)
*buf++ = *str;
++count;
}else{
- register char* p = str;
+ register char* p = str + 1;
+ if( *p != '[' ){
+ ++str;
+ continue;
+ }
while(isEscapeParam(*++p));
if( (mode == NO_RELOAD && isEscapeCommand(*p)) ||
(mode == ONLY_COLOR && *p == 'm' )){
- register int len = p - str;
+ register int len = p - str + 1;
if( buf ){
strncpy(buf, str, len);
buf += len;
}
count += len;
}
- str = p - 1;
+ str = p;
}
if( buf )
*buf = 0;