[
https://issues.apache.org/jira/browse/CLI-37?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Emmanuel Bourg resolved CLI-37.
-------------------------------
Resolution: Duplicate
Duplicate of CLI-151
> HelpFormatter does not wrap lines correctly after the second line
> -----------------------------------------------------------------
>
> Key: CLI-37
> URL: https://issues.apache.org/jira/browse/CLI-37
> Project: Commons CLI
> Issue Type: Bug
> Components: Help formatter
> Affects Versions: 1.0
> Reporter: Peter Kunszt
> Fix For: 1.2
>
>
> 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:
> {noformat}
> --- 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)
> {
> {noformat}
> 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.
-
You can reply to this email to add a comment to the issue online.