mirror of https://github.com/Sam1301/Lite.git
Print non-printable chars
This commit is contained in:
parent
0418c00ea4
commit
f905abf55e
12
editor.c
12
editor.c
|
@ -761,7 +761,17 @@ void editorDrawRows(struct AppendBuffer* ab) {
|
|||
unsigned char *hl = &E.erow[fileRow].hl[E.colOff];
|
||||
int current_color = -1; // default color
|
||||
for (int j = 0; j < len; j++) {
|
||||
if (hl[j] == HL_NORMAL) {
|
||||
if (iscntrl(c[j])) {
|
||||
char sym = (c[j] <= 26) ? '@' + c[j] : '?';
|
||||
abAppend(ab, "\x1b[7m", 4);
|
||||
abAppend(ab, &sym, 1);
|
||||
abAppend(ab, "\x1b[m", 3);
|
||||
if (current_color != -1) {
|
||||
char buf[16];
|
||||
int clen = snprintf(buf, sizeof(buf), "\x1b[%dm", current_color);
|
||||
abAppend(ab, buf, clen);
|
||||
}
|
||||
} else if (hl[j] == HL_NORMAL) {
|
||||
if (current_color != -1) {
|
||||
abAppend(ab, "\x1b[39m", 5);
|
||||
current_color = -1;
|
||||
|
|
Loading…
Reference in New Issue