Skip to content

Conversation

@samsmithnz
Copy link

@samsmithnz samsmithnz commented Jul 31, 2025

I noticed a bug that was introduced in this PR. After this PR the default width (MaxWidth) of a column is 40 - and I have a number of scenarios where I need a much longer width. This fix allows you to specify 0 as the MaxWidth property - effectively infinite - restoring some of the functionality that was present before the above PR, while also fixing a small bug identified in the unit tests.

  • Implemented unit tests in ConsoleTableTest.cs to validate the behavior of the MaxWidth property, ensuring that setting it to zero disables truncation and that positive values truncate long text correctly.
  • Updated ConsoleTable.cs to skip truncation when MaxWidth is zero or negative, refining the logic to respect word boundaries during text truncation.

As an added note, because of an indentation change, the change looks bigger than it is here in the GitHub review panel. Here is the Visual Studio comparison for reference. it's really just two if statements.

image

Implemented unit tests in `ConsoleTableTest.cs` to validate
the behavior of the `MaxWidth` property, ensuring that
setting it to zero disables truncation and that positive
values truncate long text correctly.

Updated `ConsoleTable.cs` to skip truncation when
`MaxWidth` is zero or negative, refining the logic to
respect word boundaries during text truncation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant