fixed string cutting
This commit is contained in:
parent
a514879a5c
commit
a026533b5d
@ -70,12 +70,12 @@ drawtext(const char *text, Bool invert, Bool border)
|
|||||||
while(len && (w = textnw(buf, len)) > dc.w - h)
|
while(len && (w = textnw(buf, len)) > dc.w - h)
|
||||||
buf[--len] = 0;
|
buf[--len] = 0;
|
||||||
if(len < olen) {
|
if(len < olen) {
|
||||||
|
if(len > 1)
|
||||||
|
buf[len - 1] = '.';
|
||||||
|
if(len > 2)
|
||||||
|
buf[len - 2] = '.';
|
||||||
if(len > 3)
|
if(len > 3)
|
||||||
memcpy(buf + len - 4, "...\0", 4);
|
buf[len - 3] = '.';
|
||||||
else if(len > 2)
|
|
||||||
memcpy(buf + len - 3, "..\0", 3);
|
|
||||||
else if(len > 1)
|
|
||||||
memcpy(buf + len - 2, ".\0", 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(w > dc.w)
|
if(w > dc.w)
|
||||||
|
Loading…
Reference in New Issue
Block a user