Skip to content

Commit

Permalink
Fix for drw_text cropping one characters too many when the text is to…
Browse files Browse the repository at this point in the history
…o long and replacing with ... ref. #216
  • Loading branch information
bakkeby committed Jan 20, 2022
1 parent 2c5f877 commit 4366f72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drw.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
if (utf8strlen) {
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
/* shorten text if necessary */
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL))
len--;

if (len) {
memcpy(buf, utf8str, len);
Expand Down

0 comments on commit 4366f72

Please sign in to comment.