Skip to content

Commit 4366f72

Browse files
committed
Fix for drw_text cropping one characters too many when the text is too long and replacing with ... ref. #216
1 parent 2c5f877 commit 4366f72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
507507
if (utf8strlen) {
508508
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
509509
/* shorten text if necessary */
510-
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
511-
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
510+
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL))
511+
len--;
512512

513513
if (len) {
514514
memcpy(buf, utf8str, len);

0 commit comments

Comments
 (0)