summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-06-01 11:58:19 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-06-01 11:58:19 +0100
commitc26e22cceeee5fdd40e6bd6e019729ed316e2e01 (patch)
treeba46f4af36507f6276e942ff34c1981c5ec4d353 /dwm.c
parentc2784e4a38f2305a444abaaf77f39219bd9f56e5 (diff)
Gottox' drawtext simplification
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/dwm.c b/dwm.c
index 4d4c769..3b6efaa 100644
--- a/dwm.c
+++ b/dwm.c
@@ -571,14 +571,8 @@ drawtext(const char *text, ulong col[ColLast], Bool invert) {
for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
if(!len)
return;
- if(len < olen) {
- if(len > 1)
- buf[len - 1] = '.';
- if(len > 2)
- buf[len - 2] = '.';
- if(len > 3)
- buf[len - 3] = '.';
- }
+ if(len < olen)
+ strncpy(&buf[MAX(0, len - 3)], "...", len);
XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
if(dc.font.set)
XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);