Ticket #689: patch1.diff
File patch1.diff, 2.6 KB (added by , 13 years ago) |
---|
-
src/options_description.cpp
71 71 72 72 if (approx) 73 73 { 74 if (m_long_name.find(option) == 0) 75 if (m_long_name == option) 74 if (m_long_name.find(option) == 0) { 75 if (m_long_name == option) { 76 76 result = full_match; 77 else77 } else { 78 78 result = approximate_match; 79 } 80 } 79 81 } 80 82 else 81 83 { … … 209 211 210 212 options_description::options_description(const string& caption, 211 213 unsigned line_length) 212 : m_caption(caption), m_line_length(line_length) 214 : m_caption(caption) 215 , m_line_length(line_length) 213 216 {} 214 217 215 218 void … … 502 505 503 506 if (!opt.description().empty()) 504 507 { 505 for(unsigned pad = first_column_width - ss.str().size(); 506 pad > 0; 507 --pad) 508 if (ss.str().size() >= first_column_width) 508 509 { 509 os.put(' '); 510 os.put('\n'); // first column is too long, lets put description in new line 511 for (unsigned pad = first_column_width; pad > 0; --pad) 512 { 513 os.put(' '); 514 } 515 } else { 516 for(unsigned pad = first_column_width - ss.str().size(); pad > 0; --pad) 517 { 518 os.put(' '); 519 } 510 520 } 511 512 521 format_description(os, opt.description(), 513 522 first_column_width, line_length); 514 523 } … … 531 540 ss << " " << opt.format_name() << ' ' << opt.format_parameter(); 532 541 width = (max)(width, static_cast<unsigned>(ss.str().size())); 533 542 } 543 /* this is the column were description should start, if first 544 column is longer, we go to a new line */ 545 unsigned start_of_description_column = m_line_length / 2; 546 547 width = (min)(width, start_of_description_column-1); 534 548 535 549 /* add an additional space to improve readability */ 536 550 ++width; 537 551 538 552 /* The options formatting style is stolen from Subversion. */ 539 553 for (i = 0; i < m_options.size(); ++i) 540 554 {