term: implement platform-independent console text colour/formatting
This commit is contained in:
@@ -38,7 +38,24 @@ static unsigned int extract_line(
|
||||
unsigned int i;
|
||||
for (i = 0; start[i]; i++) {
|
||||
if (start[i] == '\033') {
|
||||
while (!isalpha(start[i++])) {
|
||||
while (start[i] && !isalpha(start[i])) {
|
||||
delta++;
|
||||
i++;
|
||||
}
|
||||
|
||||
delta++;
|
||||
}
|
||||
|
||||
if (start[i] == '[') {
|
||||
if (start[i + 1] == '[') {
|
||||
delta++;
|
||||
i++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
while (start[i] && start[i] != ']') {
|
||||
i++;
|
||||
delta++;
|
||||
}
|
||||
|
||||
@@ -137,7 +154,8 @@ static b_status print_paragraph_tty(
|
||||
indent(format, fp, left_margin, false);
|
||||
}
|
||||
|
||||
b_fprintf(fp, "%s\n", b_string_ptr(line));
|
||||
b_fputs(b_string_ptr(line), fp);
|
||||
fputc('\n', fp);
|
||||
need_indent = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user