aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R.Garbe2006-08-14 10:58:03 +0200
committerAnselm R.Garbe2006-08-14 10:58:03 +0200
commit28a52197c43136945defebe1e8be82812a0e53cf (patch)
treeb471990d88808cd078bfb886d0e779b59c0d43bb
parent2c0d1cc87bf084ed3f1cdb4be881fb4f64f5773a (diff)
fixed string cutting
-rw-r--r--draw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/draw.c b/draw.c
index 6edb0a3..0ded26b 100644
--- a/draw.c
+++ b/draw.c
@@ -65,12 +65,12 @@ drawtext(const char *text, Bool invert)
while(len && (w = textnw(buf, len)) > dc.w - h)
buf[--len] = 0;
if(len < olen) {
+ if(len > 1)
+ buf[len - 1] = '.';
+ if(len > 2)
+ buf[len - 2] = '.';
if(len > 3)
- memcpy(buf + len - 4, "...\0", 4);
- else if(len > 2)
- memcpy(buf + len - 3, "..\0", 3);
- else if(len > 1)
- memcpy(buf + len - 2, ".\0", 2);
+ buf[len - 3] = '.';
}
if(w > dc.w)
@@ -160,7 +160,7 @@ drawtitle(Client *c)
}
}
dc.x += dc.w;
- dc.w = textw(c->name);
+ dc.w = c->tw - dc.x;
drawtext(c->name, !istile);
XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0);
XSync(dpy, False);