Boost logo

Boost Users :

From: Soren Soe (soren.soe_at_[hidden])
Date: 2008-08-27 13:35:15


Hi,

I have run into a problem with the program_options library chopping
words when it formats help messages. I have created a small code
fragment that will duplicate the problem:

int main()
{
   std::string p = "\n1234 6789 1234 6789 1234 6789 1234";
   format_description(std::cout, p, 20, 44);
   return 0;
}

Results in this message:

                    1234 6789 1234 6789 123
                    4 6789 1234

In case formatting is not preserved, the 3'rd instance of '1234' is
chopped into '123' with '4' on the next line.
I think there might be a bug in format_paragraph in the block that is
supposed to prevent word chopping. Specifically, this piece of code:
             
// is last_space within the second half ot the
// current line
if ((unsigned)distance(last_space, line_end) <
        (line_length - indent) / 2)
{
   line_end = last_space;
}
 
should probably not subtract 'indent' from 'line_length' since this was
already done at the very beginning of the function.

Thanks,
Soren Soe.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net