magiblot / tvision

A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
Other
2.04k stars 151 forks source link

THelpWindow: link formatting is wrong when preceded by multi-byte UTF-8 character #46

Closed electroly closed 3 years ago

electroly commented 3 years ago

I have prepared a test program: https://gist.github.com/electroly/c57e79c035b01a9f2b764311cce476a6

image image

When the é character is on the same line as the link, the link coloring and click target is shifted over by one character, misaligned from the actual link text. If you resize the help window small enough that the link wraps onto the next line, then it's fine. They must be on the same on-screen line for this to happen.

The é character in this help file is \xC3\xA9, so I assume it must be incorrectly using byte lengths for link formatting here. If I convert this file to CP437 so that the character is \x82, then it displays correctly.

magiblot commented 3 years ago

Thanks for pointing this out. https://github.com/magiblot/tvision/commit/20f331e362255d45859c36050ff75ffab078c3ab should fix it.

electroly commented 3 years ago

I tested it and it works. Thanks for the fix!