Fix a text drawing issue when tabs are used

Incorrect length was used in a substring range resulting in junk characters beyond the end of the string being printed.