File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -529,16 +529,18 @@ OptionParser::about_message() const {
529529 vector<string> parts;
530530 smithlab::split_whitespace (prog_descr, parts);
531531
532- size_t line_len = 0 ;
533532 std::ostringstream ss;
534533 ss << PROGRAM_NAME_TAG << prog_name << endl;
535- for (size_t i = 0 ; i < parts.size (); ++i) {
536- if (line_len + parts[i].size () >= MAX_LINE_LENGTH && i > 0 ) {
534+ ss << parts.front ();
535+ size_t line_len = parts.front ().length ();
536+ for (size_t i = 1 ; i < parts.size (); ++i) {
537+ if (line_len + parts[i].size () >= MAX_LINE_LENGTH) {
537538 line_len = 0 ;
538539 ss << endl;
539540 }
540- ss << parts[i] << " " ;
541- line_len += parts[i].size ();
541+ else ss << ' ' ;
542+ ss << parts[i];
543+ line_len += parts[i].length () + 1 ; // the "+1" is for the space
542544 }
543545 return ss.str ();
544546}
You can’t perform that action at this time.
0 commit comments