It seems we dropped off list.

My way of figuring out what these functions like apply_target_encoding
that don't have very descriptive docstrings do is to look at the
source code using IPython's ?? magic. If that doesn't tell enough
(e.g., it won't in this case because it's using some stuff that was
imported earlier in the file), I open the file that it lives in
(IPython will tell you this when you do ??).

That's much better than trying to guess what it does from its
behavior.  And anyway, I personally find reading source code (ideally
well docstringed and commented) to be much easier than reading
official documentation.

Aaron Meurer

On Mon, Aug 8, 2011 at 7:59 AM, Sundance <[email protected]> wrote:
> On Mon, Aug 08, 2011 at 02:50:28AM -0600, Aaron Meurer wrote:
>
>> That would be great.  I've given up trying to make this work.
>
> All RIGHT. Bug fixed, pull request sent (from account 'pvaret' on GitHub).
>
> Apparently PuDB uses urwid in very involved ways and goes significantly deeper
> than the documented API. Hence: ouch.
>
> In particular, PuDB uses the internal TextCanvas class, which expects
> bytestrings as its input. In order to convert its proper honest to goodnes
> internal Unicode strings (and yay for that, BTW), PuDB uses the undocumented
> apply_target_encoding() function from urwid. That's where the problem is.
>
> I think that function is meant to turn strings into bytes while taking into
> account wonky DEC ASCII-art codes from the days of yore. Which PuDB doesn't
> use, as far as I could tell. Additionally, apply_target_encoding() is not able
> to remap format attribute lists to account for the fact that
> len(text)<len(text.encode('utf-8')) for non-trivial values of text. (So you
> were right about the nature of the problem, Aaron, see).
>
> So I replaced the call to apply_target_encoding() with a bit of code that does
> the encoding while also remapping the attribute list.
>
> Not being super duper up to date on the deep wonders of urwid, I have no idea
> if my fix is alright or if it's a monstrous bad idea that will cause global
> economic collapse, so please, Andreas, let me know if it's just no good. :)
>
> Also fixed: tab expansion in the visualized source code now works as you'd
> expect, i.e. by aligning to every 8th column.
>
> Phew.
>
> Bye guys,
>
> -- S.
>

_______________________________________________
Pudb mailing list
[email protected]
http://lists.tiker.net/listinfo/pudb

Reply via email to