Add tests for MaxWidth and improve truncation logic #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theMaxWidthproperty - 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.ConsoleTableTest.csto validate the behavior of theMaxWidthproperty, ensuring that setting it to zero disables truncation and that positive values truncate long text correctly.ConsoleTable.csto skip truncation whenMaxWidthis 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
ifstatements.