Commit: 32615a7aa110269bc7eca86aa98070247951537f
Parent: 0cf69305a3eab123d357e485f498f3ec0815af79
Author: Randy Palamar
Date: Sun, 16 Jul 2023 10:15:41 -0600
drw.c: hack to avoid extra spaces from ctrl chars
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drw.c b/drw.c
@@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
+#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -269,7 +270,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
if (charexists) {
- drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
+ if (iscntrl(*text))
+ tmpw = 0;
+ else
+ drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
if (ew + ellipsis_width <= w) {
/* keep track where the ellipsis still fits */
ellipsis_x = x + ew;