[Ml-yokadi] renderTaskListRow is buggy

Aurélien Gâteau aurelien.gateau
Mer 18 Fév 23:09:42 CET 2009


Sébastien Renard wrote:
> Hello,
> 
> Our text renderTaskListRow is buggy. Formating relies on string length 
> (%(foo)-10s) but once we use colors it works bad. Because string length is 
> modified by ANSI colors code ! So colored word is "longer" (as a string, not 
> for ours eyes) and cause bad formating
> 
> I used a hack for urgency because colored numbers are always two digits (see 
> the ugly +" " I put on oline 66 and 68). And timeleft was the last field...
> 
> But as I was changing date creation to display task age, I just discover again 
> that forgotten bug...
> 
> Using python string fomrating is quite confortable and easy, but the only way 
> I see to keep this is either :
> - put color after padding formating
> - give fake size (removing extra ANSI colors code size)
> 
> An other solution would be to write our own formating/padding function.

Mmm... I came up with a little-over-engineered solution. What do you 
think about it?

Aurélien
-------------- section suivante --------------
Une pièce jointe non texte a été nettoyée...
Nom: textlistrender.diff
Type: text/x-diff
Taille: 5228 octets
Desc: non disponible
Url: http://sequanux.org/pipermail/ml-yokadi/attachments/20090218/eca4d6cb/attachment.diff 


Plus d'informations sur la liste de diffusion Ml-yokadi