Disclaimer: I'm in the weeds, I've looked high, low, and lower. This is an annoyance that has become
a thing ...
The Goal:
I'm trying to print info to the chat window in an aligned fashion. I think I am fighting a proportional font issue that prevents me from being able to line things up. At least, that's what I'm telling myself at the moment. Am I wrong?
The code:
Code:
d(string.format("Bottom test 1: Count (%2d): %10s = %-40s!", 1, 22, "Hello"));
d(string.format("Bottom test 2: Count (%2d): %10s = %-40s!", 2, 32, "Hello There"));
d(string.format("Bottom test 3: Count (%2d): %10s = %-40s!", 3, 42, " ii Well Hello There"));
The output:
Notice that the end of each string (marked by the ! character) is staggered, roughly by the length of the string preceding it. The exclamation points should be lining up?
The problem (as I understand it):
sprintf should be left justifying the three varying length texts (Hello, Hello There, etc.) and the exclamation point at the end should be in alignment with the one above. But, and hopefully this is obvious in the post, the string in the %-40s section isn't behaving as expected.
What is odd to me is that the second %10s strings (22,32,42) seem to be working okay though, granted, they are just numbers so maybe there isn't a lot of variance and this string definition is misbehaving like the 3rd, just not as obviously.
Either way, the question: Is there a way to properly format/align this type of output?
I've mined zo_strformat, lua's various controls, the wiki and source wherever I could find it - and am trying to avoid opening a whole new window layer where I can control the font ("avoid" is code for "I've tried 2 or 3 different examples/approaches, each resulting in a dismal failure and so I'm really hoping the solution isn't that complicated?")