diff --git a/src/osg/ApplicationUsage.cpp b/src/osg/ApplicationUsage.cpp index f9a0eef39..feeddf6f2 100644 --- a/src/osg/ApplicationUsage.cpp +++ b/src/osg/ApplicationUsage.cpp @@ -101,69 +101,74 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u std::string::size_type pos = 0; std::string::size_type offset = 0; bool firstInLine = true; - while (pos0 && - explanation[pos+width]!=' ' && - explanation[pos+width]!='\n') --width; - - if (width==0) - { - // word must be longer than a whole line so will need - // to concatinate it. - width = explanationWidth-1; - concatinated = true; - } - } + if (firstInLine) offset = 0; - line.replace(explanationPos+offset,explanationWidth, explanation, pos, width); + // skip any leading white space. + while (pos0 && + explanation[pos+width]!=' ' && + explanation[pos+width]!='\n') --width; + + if (width==0) + { + // word must be longer than a whole line so will need + // to concatinate it. + width = explanationWidth-1; + concatinated = true; + } + } + + line.replace(explanationPos+offset,explanationWidth, explanation, pos, width); + + if (concatinated) { str += line; str += "-\n"; } + else { str += line; str += "\n"; } + + // move to the next line of output. + line.assign(fullWidth,' '); + + pos += width+extraSkip; + + } + } + else + { + str += line; str += "\n"; } - } }