From 67a83975168ed5c3242b81e05c713f97ebd9be92 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Wed, 4 Dec 2019 23:45:22 -0500 Subject: [PATCH] fix truncation of long window labels --- manage.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/manage.c b/manage.c index 239e37c..895174f 100755 --- a/manage.c +++ b/manage.c @@ -341,7 +341,7 @@ getcmaps(Client *c) void setlabel(Client *c) { - char *label, *p; + char *label, *p, *lc, i; if(c->iconname != 0) label = c->iconname; @@ -355,9 +355,12 @@ setlabel(Client *c) label = "no label"; if((p = index(label, ':')) != 0) *p = '\0'; - if (sizeof(label) >= 16*sizeof(char)){ - label[15] = '~'; - label[18] = '\0'; + for (lc = label, i = 0; lc++, i++; *lc != 0){ + if (i >= 24) + { + label[22] = '~'; + label[23] = '\0'; + } } c->label = label; }