Commit b634c17e authored by Mark Olesen's avatar Mark Olesen
Browse files

fixed off-by-one error in argList text wrap

parent 37c4f2f3
......@@ -89,13 +89,13 @@ int main(int argc, char *argv[])
"index",
"start",
"ignore the time index contained in the uniform/time file "
"and use a simple indexing when creating the files"
"and use simple indexing when creating the files"
);
argList::addBoolOption
(
"noMesh",
"Suppress writing the geometry. "
"Can be useful for converting partial results for a static geometry."
"Can be useful for converting partial results for a static geometry"
);
// the volume field types that we handle
......
......@@ -166,17 +166,23 @@ void Foam::argList::printOptionUsage
string::size_type curr = pos + textWidth - 1;
string::size_type next = string::npos;
if (isspace(str[curr]) || isspace(str[curr+1]))
if (isspace(str[curr]))
{
// we were lucky: ended on a space or the next one is a space
next = str.find_first_not_of(" \t\n", curr + 1);
// we were lucky: ended on a space
next = str.find_first_not_of(" \t\n", curr);
}
else if (isspace(str[curr+1]))
{
// the next one is a space - so we are okay
curr++; // otherwise the length is wrong
next = str.find_first_not_of(" \t\n", curr);
}
else
{
// search for end of the previous word break
// search for end of a previous word break
string::size_type prev = str.find_last_of(" \t\n", curr);
// reposition to the end of the previous word if possible
// reposition to the end of previous word if possible
if (prev != string::npos && prev > pos)
{
curr = prev;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment