X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=26053b0001d90d5a1640f7110662a024c3fac770;hb=58eaa998b37bc44acbf4356a3bc4116acf570893;hp=13226d8709372553395513d876a42a86fed8af05;hpb=5159d55c631cd1179bd2f872859d4540668745b9;p=st.git diff --git a/st.c b/st.c index 13226d8..26053b0 100644 --- a/st.c +++ b/st.c @@ -180,7 +180,6 @@ typedef unsigned short ushort; typedef XftDraw *Draw; typedef XftColor Color; -typedef Colormap Colormap; typedef struct { char c[UTF_SIZ]; /* character code */ @@ -2316,19 +2315,15 @@ techo(char *buf, int len) { void tdeftran(char ascii) { - char c, (*bp)[2]; - static char tbl[][2] = { - {'0', CS_GRAPHIC0}, {'B', CS_USA}, - {0, 0} - }; - - for (bp = &tbl[0]; (c = (*bp)[0]) && c != ascii; ++bp) - /* nothing */; + static char cs[] = "0B"; + static int vcs[] = {CS_GRAPHIC0, CS_USA}; + char *p; - if (c == 0) + if((p = strchr(cs, ascii)) == NULL) { fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii); - else - term.trantbl[term.icharset] = (*bp)[1]; + } else { + term.trantbl[term.icharset] = vcs[p - cs]; + } } void @@ -2998,6 +2993,7 @@ xzoom(const Arg *arg) { xloadfonts(usedfont, usedfontsize + arg->i); cresize(0, 0); redraw(0); + xhints(); } void @@ -3250,28 +3246,22 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { bytelen -= u8cblen; doesexist = XftCharExists(xw.dpy, font->match, unicodep); - if(oneatatime || !doesexist || bytelen <= 0) { - if(oneatatime || bytelen <= 0) { - if(doesexist) { - u8fl++; - u8fblen += u8cblen; - } - } - - if(u8fl > 0) { - XftDrawStringUtf8(xw.draw, fg, - font->match, xp, - winy + font->ascent, - (FcChar8 *)u8fs, - u8fblen); - xp += xw.cw * u8fl; - - } - break; + if(doesexist) { + u8fl++; + u8fblen += u8cblen; + if(!oneatatime && bytelen > 0) + continue; } - u8fl++; - u8fblen += u8cblen; + if(u8fl > 0) { + XftDrawStringUtf8(xw.draw, fg, + font->match, xp, + winy + font->ascent, + (FcChar8 *)u8fs, + u8fblen); + xp += xw.cw * u8fl; + } + break; } if(doesexist) { if(oneatatime)