You will have to save all of the raw whois lines in whatever form you want to format them in (such as in a hidden window), then find the longest line. That's your limit (though you'll have to decide how you'll deal with line wrapping!). You might consider making sure that you don't go over a certain length in any of your formatted lines.
For instance, someone who is on a lot of channels with really long names could easily wrap (319) a couple of times, unformatted. The same can happen (frequently) for an extended away message (301). The rest of the lines probably won't wrap at all.
Once you get the formatted lines in this hidden window (I'm calling this one @WhoIs), you can find the longest line with this simple loop:
var %max = 0, %i = 1
while ($line(@WhoIs,%i)) {
if ($len($ifmatch) < %max) %max = $ifmatch
inc %i
}
Now, assuming you want to left align the text and fill out the rest of the line with just the background color, you would right-pad each line by appending $str($chr(160), %max) and then taking the $left(string, %max) to chop off the unnecessary bits and then add your color code (^k04,08) to the beginning of each line.
var %i = 1, %rightpad = $str($chr(160), %max)
while ($line(@WhoIs,%i)) {
echo -s 04,07 $+ $left($+($ifmatch,%rightpad),%max)
inc %i
}
window -c @WhoIs
In FixedSys 9, $chr(160) shows as a non-breaking space ( in HTML) or "fake space." That means that you don't have to re-set your foreground/background color to the same color. Just remember that if the window gets resized, it will definitely wrap oddly.