diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-07-04 17:17:42 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-07-04 17:17:42 +0000 |
| commit | aad4db29c2ee8fba4e0461ddf41f3e450b936b43 (patch) | |
| tree | 68766ff66494fdc434ecb1c721f0c52f778bf5ff /vt.c | |
| parent | vt: track charsets G0-G3 and support either ASCII or graphical mode (diff) | |
vt: handle graphical charset mode when printing a character
Diffstat (limited to 'vt.c')
| -rw-r--r-- | vt.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -709,9 +709,26 @@ action(struct terminal *term, enum action action, uint8_t c) cell->c[term->vt.utf8.idx] = '\0'; term->vt.utf8.idx = 0; } else { - //LOG_DBG("print: ASCII: %c", c); - cell->c[0] = c; - cell->c[1] = '\0'; + static const char *const vt100_0[62] = { /* 0x41 - 0x7e */ + "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */ + 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ + 0, 0, 0, 0, 0, 0, 0, 0, /* P - W */ + 0, 0, 0, 0, 0, 0, 0, " ", /* X - _ */ + "◆", "▒", "␉", "␌", "␍", "␊", "°", "±", /* ` - g */ + "", "␋", "┘", "┐", "┌", "└", "┼", "⎺", /* h - o */ + "⎻", "─", "⎼", "⎽", "├", "┤", "┴", "┬", /* p - w */ + "│", "≤", "≥", "π", "≠", "£", "·", /* x - ~ */ + }; + + if (term->charset[term->selected_charset] == CHARSET_GRAPHIC && + c >= 0x41 && c <= 0x7e) + { + strcpy(cell->c, vt100_0[c - 0x41]); + } else { + //LOG_DBG("print: ASCII: %c", c); + cell->c[0] = c; + cell->c[1] = '\0'; + } } cell->attrs = term->vt.attrs; |
