aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2014-01-03 02:33:08 +0100
committerjaseg <jaseg@jaseg.net>2014-01-03 02:33:08 +0100
commite2735ee530aa78f76620d6ac28564b519ab9b990 (patch)
tree9f9f0c564142f01f0d47d3bea49dfd285c87cbcd
parent4e6cc85ec4267934c77457332bef5f59352c1315 (diff)
downloadmatelight-e2735ee530aa78f76620d6ac28564b519ab9b990.tar.gz
matelight-e2735ee530aa78f76620d6ac28564b519ab9b990.tar.bz2
matelight-e2735ee530aa78f76620d6ac28564b519ab9b990.zip
Fixed width computation for escape sequences
-rw-r--r--host/matelight/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/host/matelight/main.c b/host/matelight/main.c
index 6a714a8..8ea7fc0 100644
--- a/host/matelight/main.c
+++ b/host/matelight/main.c
@@ -28,15 +28,16 @@ int console_render(char *s, glyph_t **glyph_table, unsigned int glyph_table_size
goto error;
}
for(;;){
- if(*p == '\033'){
+ while(*p == '\033'){
p++;
// Jump over escape sequences
for(;;p++){
- if(!(*p == ';' || *p == '[' || ('0' < *p && *p < '9'))){
+ if(!(*p == ';' || *p == '[' || ('0' <= *p && *p <= '9'))){
p++;
break;
}
}
+ memset(&ps, 0, sizeof(mbstate_t));
}
size_t inc = mbrtowc(&c, p, MB_CUR_MAX, &ps); // MB_CUR_MAX is safe since p is \0-terminated