aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-27 13:23:50 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-27 13:23:50 +0000
commit8d65f45bf5b7d6369c71308f680ef8e29b901ba9 (patch)
treeb6f308c97ce6fae2829cbd0575ad95d80cde90f0
parentvt: bug: fix lazy initialization of sub parameter value (off-by-one) (diff)
vt: store alt charset characters as wchars
-rw-r--r--vt.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/vt.c b/vt.c
index c6a1ab9f..3b57fd5a 100644
--- a/vt.c
+++ b/vt.c
@@ -772,20 +772,17 @@ action_print(struct terminal *term, uint8_t c)
print_insert(term);
/* 0x60 - 0x7e */
- static const char *const vt100_0[] = {
- "◆", "▒", "␉", "␌", "␍", "␊", "°", "±", /* ` - g */
- "␤", "␋", "┘", "┐", "┌", "└", "┼", "⎺", /* h - o */
- "⎻", "─", "⎼", "⎽", "├", "┤", "┴", "┬", /* p - w */
- "│", "≤", "≥", "π", "≠", "£", "·", /* x - ~ */
+ static const wchar_t vt100_0[] = {
+ L'◆', L'▒', L'␉', L'␌', L'␍', L'␊', L'°', L'±', /* ` - g */
+ L'␤', L'␋', L'┘', L'┐', L'┌', L'└', L'┼', L'⎺', /* h - o */
+ L'⎻', L'─', L'⎼', L'⎽', L'├', L'┤', L'┴', L'┬', /* p - w */
+ L'│', L'≤', L'≥', L'π', L'≠', L'£', L'·', /* x - ~ */
};
if (unlikely(term->charset[term->selected_charset] == CHARSET_GRAPHIC) &&
c >= 0x60 && c <= 0x7e)
{
- const char *glyph = vt100_0[c - 0x60];
- mbstate_t ps = {0};
- if (mbrtowc(&cell->wc, glyph, strlen(glyph), &ps) < 0)
- cell->wc = 0;
+ cell->wc = vt100_0[c - 0x60];
} else {
//LOG_DBG("print: ASCII: %c", c);
cell->wc = c;