commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r654428 - in /commons/proper/cli/branches/cli-1.x/src: java/org/apache/commons/cli/HelpFormatter.java test/org/apache/commons/cli/HelpFormatterTest.java
Date Thu, 08 May 2008 06:40:58 GMT
Author: bayard
Date: Wed May  7 23:40:58 2008
New Revision: 654428

URL: http://svn.apache.org/viewvc?rev=654428&view=rev
Log:
Applying J. Lewis Muir's patch from CLI-151 fixing HelpFormatter so it wraps properly on multiple
lines

Modified:
    commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
    commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java?rev=654428&r1=654427&r2=654428&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/HelpFormatter.java
Wed May  7 23:40:58 2008
@@ -809,7 +809,7 @@
         while (true)
         {
             text = padding + text.substring(pos).trim();
-            pos = findWrapPos(text, width, nextLineTabStop);
+            pos = findWrapPos(text, width, 0);
 
             if (pos == -1)
             {

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java?rev=654428&r1=654427&r2=654428&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/HelpFormatterTest.java
Wed May  7 23:40:58 2008
@@ -83,6 +83,18 @@
       hf.renderWrappedText(sb, 12, 4, text);
       assertEquals("single line padded text", expected, sb.toString());
 
+      text = "  -p,--period <PERIOD>  PERIOD is time duration of form " +
+          "DATE[-DATE] where DATE has form YYYY[MM[DD]]";
+
+      sb.setLength(0);
+      expected = "  -p,--period <PERIOD>  PERIOD is time duration of" +
+                 hf.getNewLine() +
+                 "                        form DATE[-DATE] where DATE" +
+                 hf.getNewLine() +
+                 "                        has form YYYY[MM[DD]]";
+      hf.renderWrappedText(sb, 53, 24, text);
+      assertEquals("single line padded text 2", expected, sb.toString());
+
       text =
          "aaaa aaaa aaaa" + hf.getNewLine() +
          "aaaaaa" + hf.getNewLine() +



Mime
View raw message