Index: libs/program_options/test/options_description_test.cpp =================================================================== --- libs/program_options/test/options_description_test.cpp (Revision 57510) +++ libs/program_options/test/options_description_test.cpp (Arbeitskopie) @@ -93,11 +93,39 @@ } +void test_word_wrapping() +{ + options_description desc("Supported options"); + desc.add_options() + ("help", "this is a sufficiently long text to require word-wrapping") + ("prefix", value()->default_value("/h/proj/tmp/dispatch"), "root path of the dispatch installation") + ("opt1", "this_is_a_sufficiently_long_text_to_require_word-wrapping_but_cannot_be_wrapped") + ("opt2", "this_is_a_sufficiently long_text_to_require_word-wrapping") + ("opt3", "this_is_a sufficiently_long_text_to_require_word-wrapping_but_will_not_be_wrapped") + ; + stringstream ss; + ss << desc; + BOOST_CHECK_EQUAL(ss.str(), +"Supported options:\n" +" --help this is a sufficiently long text to \n" +" require word-wrapping\n" +" --prefix arg (=/h/proj/tmp/dispatch) root path of the dispatch installation\n" +" --opt1 this_is_a_sufficiently_long_text_to_requ\n" +" ire_word-wrapping_but_cannot_be_wrapped\n" +" --opt2 this_is_a_sufficiently \n" +" long_text_to_require_word-wrapping\n" +" --opt3 this_is_a sufficiently_long_text_to_requ\n" +" ire_word-wrapping_but_will_not_be_wrappe\n" +" d\n" + ); +} + int main(int, char* []) { test_type(); test_approximation(); test_formatting(); test_long_default_value(); + test_word_wrapping(); return 0; } Index: libs/program_options/src/options_description.cpp =================================================================== --- libs/program_options/src/options_description.cpp (Revision 57510) +++ libs/program_options/src/options_description.cpp (Arbeitskopie) @@ -410,8 +410,8 @@ { // is last_space within the second half ot the // current line - if ((unsigned)distance(last_space, line_end) < - (line_length - indent) / 2) + if (static_cast(distance(last_space, line_end)) < + (line_length / 2)) { line_end = last_space; }