commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17682] New: - HelpFormatter does not wrap lines correctly after the second line
Date Wed, 05 Mar 2003 17:18:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17682>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17682

HelpFormatter does not wrap lines correctly after the second line

           Summary: HelpFormatter does not wrap lines correctly after the
                    second line
           Product: Commons
           Version: 1.0 Beta 2
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CLI
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: peter.kunszt@cern.ch


The HelpFormatter does not wrap the option lines
correctly because the logic in renderWrappedText
seems to be doubled up. on one side, padding is
inserted of length nextLineTabStop for every line
after the first, but then in findWrapPos this 
nextLineTabStop is ADDED to the width, resulting
in lines rendered not of width, but nextLineTabStop + width.

the following patch fixes this:

--- old/HelpFormatter.java  Wed Mar  5 18:02:18 2003
+++ new/HelpFormatter.java Wed Mar  5 17:59:47 2003
@@ -802,7 +802,7 @@
         while (true)
         {
             text = padding + text.substring(pos).trim();
-            pos = findWrapPos(text, width, nextLineTabStop);
+            pos = findWrapPos(text, width, 0);

             if (pos == -1)
             {


however, this reduces the usage of findWrapPos to always
using the third argument = 0 which makes most of its logic
obsolete. it could be rewritten to be MUCH shorter. but maybe
i'm just missing something.

the output is fully satisfactory now.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message