Commit: 8fb1b66e87af7014e4b0b13db4db1cf3bc6e75c7
Parent: 5583b17f8e90a21c6f0a5d752896769b01505c40
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>
@@ -271,7 +272,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;