Max E. Kuznecov wrote:
> Hi,
> I've found a strange behaviour of TextCanvas in my application: it is
> a visual shell, like mc.
> The idea is well-known: I display filesystem objects in two panels,
> each object can have different atrributes depending on its type, name
> etc.
> So I found that filenames in multibyte characters (in my case
> -cyrillic) are incorrectly rendered, more precisely - background
> doesn't fit into overall panel width (see attached screenshot).
> You can see that both objects with cyrillic names have a  trailing
> block not covered with required palette, while file with latin name
> (XYZ) renders just fine.
> Code is something like:
>
> x = lowui.TextCanvas(text=[_text],
>                                      attr=[[(_own_attr, maxcol)]],
>                                      maxcol=maxcol)
>                 canvases.append((x, i, False))
>
> It cycles through all objects in directory, renders it one by one and
> then combines canvases.
>
> I've skimmed through TextCanvas definition - there is a line in constructor:
> a_gap = len(text[i]) - rle_len( attr[i] )
> which uses len() on multibyte string, I've tried to replace it with
> calc_width() from utils but then I got a different error. Nevertheless
> I'm not deeply familiar with urwid's internals so I'd better ask here:
> Is it a bug or maybe there is a different way to achieve the desired result.
> Thanks.
>
> P.S. Debian, utf-8 locale, urwid version 0.9.8.4-1
>   
Looks like a bug.  Can you post a short example program that causes the 
problem?
 
It's not common to assemble the canvases yourself.  It's usually easier 
to use Text widgets, even if you just use them to create the Canvas.  If 
you post some code I may be able to make a suggestion.

Ian


_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to