| 18 |
#include "lml.h" |
#include "lml.h" |
| 19 |
#include "log.h" |
#include "log.h" |
| 20 |
#include "str_process.h" |
#include "str_process.h" |
| 21 |
|
#include <ctype.h> |
| 22 |
#include <stdio.h> |
#include <stdio.h> |
| 23 |
#include <string.h> |
#include <string.h> |
| 24 |
#include <sys/param.h> |
#include <sys/param.h> |
| 252 |
new_line = 0; |
new_line = 0; |
| 253 |
} |
} |
| 254 |
|
|
| 255 |
if (str_in[i] == '\033' && str_in[i + 1] == '[') // Escape sequence -- copy directly |
if (str_in[i] == '\033' && str_in[i + 1] == '[') // Escape sequence |
| 256 |
{ |
{ |
| 257 |
for (k = i + 2; str_in[k] != '\0' && str_in[k] != 'm' && str_in[k] != '\033'; k++) |
for (k = i + 2; isdigit(str_in[k]) || str_in[k] == ';' || str_in[k] == '?'; k++) |
| 258 |
; |
; |
| 259 |
|
|
| 260 |
if (str_in[k] != 'm') // invalid |
if (str_in[k] == 'm') // valid -- copy directly |
| 261 |
|
{ |
| 262 |
|
CHECK_AND_APPEND_OUTPUT(str_out, buf_len, j, str_in + i, k - i + 1, line_width); |
| 263 |
|
} |
| 264 |
|
else if (isalpha(str_in[k])) |
| 265 |
|
{ |
| 266 |
|
// unsupported ANSI CSI command |
| 267 |
|
} |
| 268 |
|
else |
| 269 |
{ |
{ |
| 270 |
k--; |
k--; |
| 271 |
} |
} |
| 272 |
|
|
|
CHECK_AND_APPEND_OUTPUT(str_out, buf_len, j, str_in + i, k - i + 1, line_width); |
|
| 273 |
i = k; |
i = k; |
| 274 |
continue; |
continue; |
| 275 |
} |
} |