note
ibm1620
I notice that you're inserting <code>\e[m</code> before line endings. Apparently neither <code>ta_length()</code> nor <code>ta_pad()</code> can deal with this sequence (i.e. treat it as non-printing). I changed the two places in your code where you insert that sequence to insert <code>\e[0m</code> instead, and it passed my limited testing.
<p>
I don't know if that's the <em>right</em> fix, though. :-)
11143680
11145905