|
@@ -1094,6 +1094,27 @@ tmoveto(int x, int y) {
|
|
|
|
|
|
void
|
|
void
|
|
tsetchar(char *c) {
|
|
tsetchar(char *c) {
|
|
|
|
+
|
|
|
|
+ * The table is proudly stolen from rxvt.
|
|
|
|
+ */
|
|
|
|
+ if(term.c.attr.mode & ATTR_GFX) {
|
|
|
|
+ char *vt100_0[62] = {
|
|
|
|
+ "↑", "↓", "→", "←", "█", "▚", "☃",
|
|
|
|
+ 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
+ 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
+ 0, 0, 0, 0, 0, 0, 0, " ",
|
|
|
|
+ "◆", "▒", "␉", "␌", "␍", "␊", "°", "±",
|
|
|
|
+ "", "␋", "┘", "┐", "┌", "└", "┼", "⎺",
|
|
|
|
+ "⎻", "─", "⎼", "⎽", "├", "┤", "┴", "┬",
|
|
|
|
+ "│", "≤", "≥", "π", "≠", "£", "·",
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if(c[0] >= 0x41 && c[0] <= 0x7e
|
|
|
|
+ && vt100_0[c[0] - 0x41]) {
|
|
|
|
+ c = vt100_0[c[0] - 0x41];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
term.dirty[term.c.y] = 1;
|
|
term.dirty[term.c.y] = 1;
|
|
term.line[term.c.y][term.c.x] = term.c.attr;
|
|
term.line[term.c.y][term.c.x] = term.c.attr;
|
|
memcpy(term.line[term.c.y][term.c.x].c, c, UTF_SIZ);
|
|
memcpy(term.line[term.c.y][term.c.x].c, c, UTF_SIZ);
|
|
@@ -1177,7 +1198,7 @@ tsetattr(int *attr, int l) {
|
|
switch(attr[i]) {
|
|
switch(attr[i]) {
|
|
case 0:
|
|
case 0:
|
|
term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \
|
|
term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \
|
|
- | ATTR_ITALIC | ATTR_BLINK | ATTR_GFX);
|
|
+ | ATTR_ITALIC | ATTR_BLINK);
|
|
term.c.attr.fg = DefaultFG;
|
|
term.c.attr.fg = DefaultFG;
|
|
term.c.attr.bg = DefaultBG;
|
|
term.c.attr.bg = DefaultBG;
|
|
break;
|
|
break;
|
|
@@ -1676,12 +1697,18 @@ tputc(char *c, int len) {
|
|
strhandle();
|
|
strhandle();
|
|
} else if(term.esc & ESC_ALTCHARSET) {
|
|
} else if(term.esc & ESC_ALTCHARSET) {
|
|
switch(ascii) {
|
|
switch(ascii) {
|
|
- case '0':
|
|
+ case '0':
|
|
term.c.attr.mode |= ATTR_GFX;
|
|
term.c.attr.mode |= ATTR_GFX;
|
|
break;
|
|
break;
|
|
- case 'B':
|
|
+ case 'B':
|
|
term.c.attr.mode &= ~ATTR_GFX;
|
|
term.c.attr.mode &= ~ATTR_GFX;
|
|
break;
|
|
break;
|
|
|
|
+ case 'A':
|
|
|
|
+ case '<':
|
|
|
|
+ case '5':
|
|
|
|
+ case 'C':
|
|
|
|
+ case 'K':
|
|
|
|
+ break;
|
|
default:
|
|
default:
|
|
fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
|
|
fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
|
|
}
|
|
}
|
|
@@ -1700,10 +1727,14 @@ tputc(char *c, int len) {
|
|
strescseq.type = ascii;
|
|
strescseq.type = ascii;
|
|
term.esc |= ESC_STR;
|
|
term.esc |= ESC_STR;
|
|
break;
|
|
break;
|
|
- case ')':
|
|
+ case '(':
|
|
- case '(':
|
|
|
|
term.esc |= ESC_ALTCHARSET;
|
|
term.esc |= ESC_ALTCHARSET;
|
|
break;
|
|
break;
|
|
|
|
+ case ')':
|
|
|
|
+ case '*':
|
|
|
|
+ case '+':
|
|
|
|
+ term.esc = 0;
|
|
|
|
+ break;
|
|
case 'D':
|
|
case 'D':
|
|
if(term.c.y == term.bot)
|
|
if(term.c.y == term.bot)
|
|
tscrollup(term.top, 1);
|
|
tscrollup(term.top, 1);
|
|
@@ -2067,7 +2098,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
|
int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
|
|
int winx = BORDER+x*xw.cw, winy = BORDER+y*xw.ch + dc.font.ascent, width = charlen*xw.cw;
|
|
Font *font = &dc.font;
|
|
Font *font = &dc.font;
|
|
XGlyphInfo extents;
|
|
XGlyphInfo extents;
|
|
- int i;
|
|
|
|
|
|
|
|
|
|
|
|
if(IS_SET(MODE_REVERSE)) {
|
|
if(IS_SET(MODE_REVERSE)) {
|
|
@@ -2093,16 +2123,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
|
|
XSetBackground(xw.dpy, dc.gc, dc.col[bg]);
|
|
XSetBackground(xw.dpy, dc.gc, dc.col[bg]);
|
|
XSetForeground(xw.dpy, dc.gc, dc.col[fg]);
|
|
XSetForeground(xw.dpy, dc.gc, dc.col[fg]);
|
|
|
|
|
|
- if(base.mode & ATTR_GFX) {
|
|
|
|
- for(i = 0; i < bytelen; i++) {
|
|
|
|
- char c = gfx[(uint)s[i] % 256];
|
|
|
|
- if(c)
|
|
|
|
- s[i] = c;
|
|
|
|
- else if(s[i] > 0x5f)
|
|
|
|
- s[i] -= 0x5f;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
XftTextExtentsUtf8(xw.dpy, font->xft_set, (FcChar8 *)s, bytelen, &extents);
|
|
XftTextExtentsUtf8(xw.dpy, font->xft_set, (FcChar8 *)s, bytelen, &extents);
|
|
width = extents.xOff;
|
|
width = extents.xOff;
|
|
XftDrawRect(xw.xft_draw, &dc.xft_col[bg], winx, winy - font->ascent, width, xw.ch);
|
|
XftDrawRect(xw.xft_draw, &dc.xft_col[bg], winx, winy - font->ascent, width, xw.ch);
|