Make numbers red

This commit is contained in:
Aaron Fischer 2018-10-12 17:04:01 +02:00
parent 1a24341130
commit 6f8ea7487b

12
kilo.c
View file

@ -537,7 +537,17 @@ void editorDrawRows(struct abuf *ab) {
int len = E.row[filerow].rsize - E.coloff;
if (len < 0) len = 0;
if (len > E.screencols) len = E.screencols;
abAppend(ab, &E.row[filerow].render[E.coloff], len);
char *c = &E.row[filerow].render[E.coloff];
int j;
for (j=0; j<len; j++) {
if (isdigit(c[j])) {
abAppend(ab, "\x1b[31m", 5);
abAppend(ab, &c[j], 1);
abAppend(ab, "\x1b[39m", 5);
} else {
abAppend(ab, &c[j], 1);
}
}
}
abAppend(ab, "\x1b[K", 3); // Erase one line