Skip to content

Commit 6a58545

Browse files
committed
Adjusting - best is to switch to an indent of 1 than do silly things like having every line have 1 character. CLI-162
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@748463 13f79535-47bb-0310-9956-ffa450edef68
1 parent 02dd7c2 commit 6a58545

2 files changed

Lines changed: 4 additions & 23 deletions

File tree

src/java/org/apache/commons/cli/HelpFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ protected StringBuffer renderWrappedText(StringBuffer sb, int width,
822822
if (nextLineTabStop >= width)
823823
{
824824
// stops infinite loop happening
825-
nextLineTabStop = width - 1;
825+
nextLineTabStop = 1;
826826
}
827827

828828
// all following lines must be padded with nextLineTabStop space

src/test/org/apache/commons/cli/bug/BugCLI162Test.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -267,34 +267,15 @@ public void testLongLineChunkingIndentIgnored() throws ParseException, IOExcepti
267267
HelpFormatter formatter = new HelpFormatter();
268268
StringWriter sw = new StringWriter();
269269
formatter.printHelp(new PrintWriter(sw), 22, this.getClass().getName(), "Header", options, 0, 5, "Footer");
270+
System.err.println(sw.toString());
270271
String expected = "usage:\n" +
271272
" org.apache.comm\n" +
272273
" ons.cli.bug.Bug\n" +
273274
" CLI162Test\n" +
274275
"Header\n" +
275276
"-x,--extralongarg\n" +
276-
" T\n" +
277-
" h\n" +
278-
" i\n" +
279-
" s\n" +
280-
" d\n" +
281-
" e\n" +
282-
" s\n" +
283-
" c\n" +
284-
" r\n" +
285-
" i\n" +
286-
" p\n" +
287-
" t\n" +
288-
" i\n" +
289-
" o\n" +
290-
" n\n" +
291-
" i\n" +
292-
" s\n" +
293-
" L\n" +
294-
" o\n" +
295-
" n\n" +
296-
" g\n" +
297-
" .\n" +
277+
" This description is\n" +
278+
" Long.\n" +
298279
"Footer\n";
299280
assertEquals( "Long arguments did not split as expected", expected, sw.toString() );
300281
}

0 commit comments

Comments
 (0)