Re: [hackers] [libsl|dmenu][PATCH v2] Fix truncation issues and improve performance
On Tue, Mar 29, 2022 at 05:18:12PM +0200, Stein Gunnar Bakkeby wrote:
> For 0002 how about leaving the ellipsis_width as 0 and do this?
>
> if (!ellipsis_width && render)
> ellipsis_width = drw_fontset_getwidth(drw, ellipsis);
When invoked from drw_fontset_getwidth(), `render` wont be active, so
yeah this will get rid of the infinite recursion as well. And
ellipsis_width is only relevant when rendering, so it makes sense to do
it this way.
In fact, I think just reducing the condition to `if (render)` and
reverting ellipsis_width to be automatic variable again would work as
well. But since ellipsis_width won't change, makes sense to make it
static and calculate it only once.
> Moving the "..." to a static(?) const variable named ellipsis would make it
> easier to replace this with something else (like the ellipsis character for
> example).
Currently it's used only in 2 locations, so don't think it should be
hard for someone to change it if they wish.
Attached the amended patches.
- NRK
Received on Wed Mar 30 2022 - 08:26:56 CEST
This archive was generated by hypermail 2.3.0
: Wed Mar 30 2022 - 08:36:34 CEST