Skip to content

Commit 9c2b7e0

Browse files
Fixing formatting for description of program in OptionParser
1 parent e140779 commit 9c2b7e0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

OptionParser.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)