yeah, you can definitely do it with some pretty simple regular expression work. I can't claim credit for this specific function and I haven't expansively tested it, but this has reliably stripped style tags out of strings so I can get the "real" length.
tags = "align|alpha|color|b|i|cspace|font|indent|line-height|line-indent|link|lowercase|uppercase|smallcaps|margin|mark|mspace|noparse|nobr|page|pos|size|space|sprite|s|u|style|sub|sup|voffset|width|link|#[0-9a-f]{3}|#[0-9a-f]{6}"
return text.replace("<\/?(" + tags + ")(\s.*?|=.*?|.{0})>", "")
end function
While being able to specify terminal height and width and cursor position would be nice, there's at least one open suggestion for that, and it's not entirely difficult to build a system to do the output you may want within the current constraints. I'm in the middle of working on a modular, user-defined terminal-based UI, so I can say for sure it's a bit tedious, but not overly difficult.