fixed off-by-one error in argList text wrap
This commit is contained in:
parent
37c4f2f375
commit
b634c17e55
@ -89,13 +89,13 @@ int main(int argc, char *argv[])
|
|||||||
"index",
|
"index",
|
||||||
"start",
|
"start",
|
||||||
"ignore the time index contained in the uniform/time file "
|
"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
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noMesh",
|
"noMesh",
|
||||||
"Suppress writing the geometry. "
|
"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
|
// 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 curr = pos + textWidth - 1;
|
||||||
string::size_type next = string::npos;
|
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
|
// we were lucky: ended on a space
|
||||||
next = str.find_first_not_of(" \t\n", curr + 1);
|
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
|
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);
|
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)
|
if (prev != string::npos && prev > pos)
|
||||||
{
|
{
|
||||||
curr = prev;
|
curr = prev;
|
||||||
|
Loading…
Reference in New Issue
Block a user