[hackers] [st] undefined gfx doesn't draw \0. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Thu, 2 Sep 2010 18:24:55 +0000 (UTC)

changeset: 139:2ea069649054
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Thu Sep 02 20:21:40 2010 +0200
files: st.c
description:
undefined gfx doesn't draw \0.

diff -r 656f8e521f85 -r 2ea069649054 st.c
--- a/st.c Thu Sep 02 02:03:53 2010 +0200
+++ b/st.c Thu Sep 02 20:21:40 2010 +0200
@@ -677,7 +677,8 @@
                         else if(BETWEEN(attr[i], 100, 107))
                                 term.c.attr.fg = attr[i] - 100 + 8;
                         else
- fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]);
+ fprintf(stderr, "erresc: gfx attr %d unknown\n", attr[i]), csidump();
+
                         break;
                 }
         }
@@ -1230,8 +1231,13 @@
         XSetForeground(xw.dis, dc.gc, xfg);
         
         if(base.mode & ATTR_GFX)
- for(i = 0; i < len; i++)
- s[i] = gfx[(int)s[i]];
+ for(i = 0; i < len; i++) {
+ char c = gfx[(unsigned int)s[i] % 256];
+ if(c)
+ s[i] = c;
+ else if(s[i] > 0x5f)
+ s[i] -= 0x5f;
+ }
 
         XSetFont(xw.dis, dc.gc, base.mode & ATTR_BOLD ? dc.bfont->fid : dc.font->fid);
         XDrawImageString(xw.dis, xw.buf, dc.gc, winx, winy, s, len);
Received on Thu Sep 02 2010 - 20:24:55 CEST

This archive was generated by hypermail 2.2.0 : Thu Sep 02 2010 - 20:36:04 CEST