mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Fix for drw_text cropping one characters too many when the text is too long and replacing with ... ref. #216
This commit is contained in:
parent
2c5f877bd2
commit
4366f72390
4
drw.c
4
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) {
|
if (utf8strlen) {
|
||||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
||||||
/* shorten text if necessary */
|
/* shorten text if necessary */
|
||||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; drw_font_getexts(usedfont, utf8str, len, &ew, NULL))
|
||||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
len--;
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
memcpy(buf, utf8str, len);
|
memcpy(buf, utf8str, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user