Index: src/options_description.cpp =================================================================== --- src/options_description.cpp (Revision 56996) +++ src/options_description.cpp (Arbeitskopie) @@ -71,11 +71,13 @@ if (approx) { - if (m_long_name.find(option) == 0) - if (m_long_name == option) + if (m_long_name.find(option) == 0) { + if (m_long_name == option) { result = full_match; - else + } else { result = approximate_match; + } + } } else { @@ -209,7 +211,8 @@ options_description::options_description(const string& caption, unsigned line_length) - : m_caption(caption), m_line_length(line_length) + : m_caption(caption) + , m_line_length(line_length) {} void @@ -502,13 +505,19 @@ if (!opt.description().empty()) { - for(unsigned pad = first_column_width - ss.str().size(); - pad > 0; - --pad) + if (ss.str().size() >= first_column_width) { - os.put(' '); + os.put('\n'); // first column is too long, lets put description in new line + for (unsigned pad = first_column_width; pad > 0; --pad) + { + os.put(' '); + } + } else { + for(unsigned pad = first_column_width - ss.str().size(); pad > 0; --pad) + { + os.put(' '); + } } - format_description(os, opt.description(), first_column_width, line_length); } @@ -531,10 +540,15 @@ ss << " " << opt.format_name() << ' ' << opt.format_parameter(); width = (max)(width, static_cast(ss.str().size())); } + /* this is the column were description should start, if first + column is longer, we go to a new line */ + unsigned start_of_description_column = m_line_length / 2; + + width = (min)(width, start_of_description_column-1); /* add an additional space to improve readability */ ++width; - + /* The options formatting style is stolen from Subversion. */ for (i = 0; i < m_options.size(); ++i) {