aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/term.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/main/term.c b/main/term.c
index e92a27077..bdafa49e2 100644
--- a/main/term.c
+++ b/main/term.c
@@ -264,31 +264,28 @@ char *term_prompt(char *outbuf, const char *inbuf, int maxout)
return outbuf;
}
-
/* filter escape sequences */
void term_filter_escapes(char *line)
{
int i;
- for (i=0; i < strlen(line); i++) {
- if (line[i] == ESC) {
- if (line[i+1] == '\x5b') {
- switch (line[i+2]) {
- case '\x30':
- break;
- case '\x31':
- break;
- case '\x33':
- break;
- default:
- /* replace ESC with a space */
- line[i] = ' ';
- }
- } else {
- /* replace ESC with a space */
- line[i] = ' ';
- }
- }
+ for (i = 0; i < strlen(line); i++) {
+ if (line[i] != ESC)
+ continue;
+ if (line[i + 1] == '\x5b') {
+ switch (line[i + 2]) {
+ case '\x30':
+ case '\x31':
+ case '\x33':
+ break;
+ default:
+ /* replace ESC with a space */
+ line[i] = ' ';
+ }
+ } else {
+ /* replace ESC with a space */
+ line[i] = ' ';
+ }
}
}