> if (!ellipsis_width && render)
> ellipsis_width = drw_fontset_getwidth(drw, "...");
> - if (!invalid_width) {
> - invalid_width = -1; /* stop infinite recursion */
> + if (!invalid_width && render)
> invalid_width = drw_fontset_getwidth(drw, invalid);
> - }
This is what I had initially but this caused some bug because it causes
mismatch between drw_fontset_getwidth() vs the width that actually gets
rendered. On the first call, drw_fontset_getwidth() will calculate the
width with invalid_width being 0 but when rendering it will be non-zero
which messes up some calculation.
I'm also noticing now that if you put an invalid byte at the very end it
fails to render the ellipsis when truncating the text. To reproduce try
to put as many 'a' in there to push the invalid byte *just* beyond the
width of the reigion.
$ printf "aaaaa....aaaaa\xff" | ./dmenu
I've attached a pic where there should be an ellipsis at the end but
isn't.
I remember testing this case and fixing it by doing the
`invalid_width = -1` thing so that it gets initialized even when not
rendering. But now it happens even after I revert this patch. Weird.
I'll look into what's going wrong here and fix it.
- NRK
Received on Sun Jul 14 2024 - 12:31:55 CEST