You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/07/10 09:04:30 UTC

[jira] Updated: (CLI-37) [cli] HelpFormatter does not wrap lines correctly after the second line

     [ http://issues.apache.org/jira/browse/CLI-37?page=all ]

Henri Yandell updated CLI-37:
-----------------------------

    Bugzilla Id:   (was: 17682)
    Fix Version: 2.0

Evaluate for 2.0, see if the two HelpFormatters are much the same and fix in the 2.0 version.

> [cli] HelpFormatter does not wrap lines correctly after the second line
> -----------------------------------------------------------------------
>
>          Key: CLI-37
>          URL: http://issues.apache.org/jira/browse/CLI-37
>      Project: Commons CLI
>         Type: Bug

>     Versions: 1.0
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Peter Kunszt
>      Fix For: 2.0

>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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