Boost logo

Boost :

Subject: Re: [boost] [program_options] Formatting; split at space
From: Sascha Ochsenknecht (s.ochsenknecht_at_[hidden])
Date: 2009-11-30 11:56:17


Hi Chad,

Am 30.11.2009 17:03, schrieb Chard:
> Function: format_paragraph
> File: options_description.cpp, line 423:
>
> if (last_space != line_begin)
> {
> // is last_space within the second half ot the
> // current line
> if ((unsigned)distance(last_space, line_end) <
> (line_length - indent) / 2) // "- indent" ?
> {
> line_end = last_space;
> }
> }
>
> I'm given to understand that the code around here is designed to split the
> description at a space, iff the space occurs at least half-way through the
> description text.
>
> The code currently subtracts the indent from the line_length, where the
> line_length (within format_paragraph) represents the space available for the
> description (indent has already been subtracted from line_length at the
> beginning of format_paragraph).
>
> The result is that the longer the option names, the less chance of the split
> occurring at a space within the description. Was this the intention?
>
> E.g. if an option is 40 chars long, then there is no chance of it splitting at
> a space (for 80 column default).
>

This is code is already patched on trunk:

if (last_space != line_begin)
{
    // is last_space within the second half ot the
    // current line
    if (static_cast<unsigned>(distance(last_space, line_end)) <
        (line_length / 2))
    {
        line_end = last_space;
    }
}

So, it will look for a space in the second half of the description part
of the text.
This patch was submitted with Ticket #2613.

I can not say if it is already merged to release branch.

Cheers,
Sascha


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk