Skip to content

Commit

Permalink
ParserSettings and HelpText assume that Console.WindowWidth throws fo…
Browse files Browse the repository at this point in the history
…r non-Windows environments, but this is not true in more recent versions of Mono (returns 0 instead). This change will cause it to default to DefaultMaximumLength in the event that Console.WindowWidth returns 0.
  • Loading branch information
Branden Conley committed Apr 23, 2018
1 parent c363001 commit a9263c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CommandLine/ParserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public ParserSettings()
try
{
maximumDisplayWidth = Console.WindowWidth;
if (maximumDisplayWidth < 1)
{
maximumDisplayWidth = DefaultMaximumLength;
}
}
catch (IOException)
{
Expand Down
4 changes: 4 additions & 0 deletions src/CommandLine/Text/HelpText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public HelpText(SentenceBuilder sentenceBuilder, string heading, string copyrigh
try
{
maximumDisplayWidth = Console.WindowWidth;
if (maximumDisplayWidth < 1)
{
maximumDisplayWidth = DefaultMaximumLength;
}
}
catch (IOException)
{
Expand Down

0 comments on commit a9263c2

Please sign in to comment.