Fix Format-Table where rows were being trimmed unnecessarily if there's only one row of headers#6772
Conversation
|
|
||
| abc bcd | ||
| --- --- | ||
| 1234 123 |
There was a problem hiding this comment.
Should 4 be on new next line?
abc bcd
--- ---
123 123
4
There was a problem hiding this comment.
That's only if there is a format file that specifies the width. When there isn't it will auto set the width of a column based on the first few samples of the output. So in this case, the 1234 dictate the width of column 1.
There was a problem hiding this comment.
Is the fix (and the bug) for autosize only?
There was a problem hiding this comment.
Could you please add a comment or change the test header that it is a implicit autosize?
(Also we should add later tests for explicit -AutoSize.)
There was a problem hiding this comment.
Updated test description to make clear and added more rows to cover accidental trim of a row and not just header
PR Summary
In the case where a row doesn't expand to multiple rows, columns were still being trimmed of whitespace which introduces invalid alignment as the whitespace needs to be retained.
Added new tests to cover this scenario. Updated some existing tests to use
^instead of backtick to represent newline making it easier to replace it back with a newline to visualize during debugging when test fails.Fix #6767
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests