On Mon, Aug 09, 2021 at 06:35:57PM +0200, Hiltjo Posthuma wrote:
> On Sat, Aug 07, 2021 at 09:39:44PM -0400, Miles Alan wrote:
> > On Sat, Aug 7, 2021, at 9:34 PM, m...@milesalan.com wrote:
> > > -                 for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew 
> > > > w; len--)
> > > -                         drw_font_getexts(usedfont, utf8str, len, &ew, 
> > > NULL);
> > > +                 if (ew > w)
> > > +                         for (ew = 0, len = 0; ew < w - lpad * 2 && len 
> > > < MIN(utf8strlen, 
> > > sizeof(buf) - 1); len++)
> > > +                                 drw_font_getexts(usedfont, utf8str, 
> > > len, &ew, NULL);
> > > +                 else
> > > +                         len = MIN(utf8strlen, sizeof(buf) - 1);
> > 
> > To test, try selecting previous/next items with the following (adjust -c as 
> > needed):
> > for i in $(seq 20); do
> >   cat /dev/urandom | base64 | tr -d '\n' | head -c 1000000
> > done | ./dmenu -l 10
> > 
> 
> Hi Miles,
> 
> Thanks for the patch. It uses indeed less resources for very long lines and it
> makes more sense to do it this way.
> 
> A small change for the test script, you probably want to add a newline (echo)
> between it:
> 
>       for i in $(seq 20); do
>               cat /dev/urandom | base64 | tr -d '\n' | head -c 1000000
>       echo
>       done | ./dmenu -l 10
> 
> I synced the code to dwm and the libsl repository too.
> 
> -- 
> Kind regards,
> Hiltjo
> 

Hi,

This patch had issues so it was reverted for now. Anyone have time to work on
this during the holidays maybe?

The drw.c drw_text() text truncation code using "..." is also incorrect
currently for UTF-8 and when multiple fallback fonts are used.

-- 
Kind regards,
Hiltjo

Reply via email to