Re: [hackers] [libsl|dmenu][PATCH v2] Fix truncation issues and improve performance
On Sat, Mar 26, 2022 at 12:02:12AM +0100, Stein Gunnar Bakkeby wrote:
> for the first patch, what was the incentive for making a call to drw_text
> to draw the ellipsis rather than making another call to XftDrawStringUtf8?
Was simpler to just call drw_text.
> As-is, and I am primarily thinking of the bar in dwm in this case, if you
> were to have limited space and there is only enough space to write one or
> two characters then you have a situation where the ellipsis would never
> fit, but the text will overflow.
>
> In this situation the ellipsis_w variable will remain 0 and drw_text is
> called again with a width of 0 to draw the ellipsis. I believe it might
> crash with that.
Hmm, how about this:
diff --git a/drw.c b/drw.c
index 4cccf47..411bcdd 100644
--- a/drw.c
+++ b/drw.c
_AT_@ -336,7 +336,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
x += ew;
w -= ew;
}
- if (render && overflow)
+ if (render && overflow && ellipsis_w)
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
if (!*text || overflow) {
- NRK
Received on Sun Mar 27 2022 - 20:51:54 CEST
This archive was generated by hypermail 2.3.0
: Sun Mar 27 2022 - 21:00:35 CEST