diff options
author | June McEnroe <june@causal.agency> | 2019-08-18 15:11:01 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-08-18 15:11:01 -0400 |
commit | 83364534ca9ab777d824392b6fc1f3befedca62f (patch) | |
tree | 54ef50e45940cfd80488dc7c3f031d992c2c406c /term.c | |
parent | Fix CSI param counting (diff) | |
download | stream-master.tar.gz stream-master.zip |
Diffstat (limited to 'term.c')
-rw-r--r-- | term.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/term.c b/term.c index 342bc66..aa44454 100644 --- a/term.c +++ b/term.c @@ -320,7 +320,28 @@ ACTION(sgr) { } } +enum { + USASCII, + DECSpecial, +}; + +ACTION(usascii) { t->charset = USASCII; } +ACTION(decSpecial) { t->charset = DECSpecial; } + +static const wchar_t AltCharset[128] = { + ['`'] = L'◆', ['a'] = L'▒', ['f'] = L'°', ['g'] = L'±', ['i'] = L'␋', + ['j'] = L'┘', ['k'] = L'┐', ['l'] = L'┌', ['m'] = L'└', ['n'] = L'┼', + ['o'] = L'⎺', ['p'] = L'⎻', ['q'] = L'─', ['r'] = L'⎼', ['s'] = L'⎽', + ['t'] = L'├', ['u'] = L'┤', ['v'] = L'┴', ['w'] = L'┬', ['x'] = L'│', + ['y'] = L'≤', ['z'] = L'≥', ['{'] = L'π', ['|'] = L'≠', ['}'] = L'£', + ['~'] = L'·', +}; + ACTION(add) { + if (t->charset == DECSpecial && ch < 128 && AltCharset[ch]) { + ch = AltCharset[ch]; + } + int width = wcwidth(ch); if (width < 0) { unhandled("\\u%02X", ch); @@ -364,6 +385,11 @@ ACTION(escDefault) { unhandled("ESC %lc", ch); } +ACTION(g0Default) { + unhandled("G0 %lc", ch); + t->charset = USASCII; +} + ACTION(csiInter) { switch (t->state) { break; case CSI: unhandled("CSI %lc ...", ch); @@ -414,7 +440,9 @@ void termUpdate(struct Term *term, wchar_t ch) { D(escDefault, Data); } S(G0) { - D(nop, Data); + A('0', decSpecial, Data); + A('B', usascii, Data); + D(g0Default, Data); } S(CSI) { |