Bug 1248352 - Allow shell option parsing code to handle help text containing blank lines r=jandem

This commit is contained in:
Jon Coppeard 2016-02-26 11:04:15 +00:00
parent fac88e025d
commit eb986dbae4

View File

@ -95,7 +95,7 @@ PrintParagraph(const char* text, unsigned startColno, const unsigned limitColno,
++it;
while (*it != '\0') {
MOZ_ASSERT(!isspace(*it));
MOZ_ASSERT(!isspace(*it) || *it == '\n');
/* Delimit the current token. */
const char* limit = it;
@ -106,9 +106,7 @@ PrintParagraph(const char* text, unsigned startColno, const unsigned limitColno,
* If the current token is longer than the available number of columns,
* then make a line break before printing the token.
*/
MOZ_ASSERT(limit - it > 0);
size_t tokLen = limit - it;
MOZ_ASSERT(tokLen);
if (tokLen + colno >= limitColno) {
printf("\n%*s%.*s", startColno + indent, "", int(tokLen), it);
colno = startColno + tokLen;