summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-01-20 22:21:55 +0100
committerbakkeby <[email protected]>2022-02-11 11:43:36 +0100
commit8e36c36bcf4c5ba53949923d75ad46f984c12cbc (patch)
tree257b2c08a37c09071522155de55ced6ebe97daaf
parentd1662b6636202ae5c6aea81074b539fa7f347322 (diff)
downloaddwm-flexipatch-8e36c36bcf4c5ba53949923d75ad46f984c12cbc.tar.gz
dwm-flexipatch-8e36c36bcf4c5ba53949923d75ad46f984c12cbc.zip
Fix for drw_text cropping one characters too many when the text is too long and replacing with ... ref. #216
-rw-r--r--drw.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drw.c b/drw.c
index 0fc9f05..afb6477 100644
--- a/drw.c
+++ b/drw.c
@@ -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);